mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
UWP: Bookmarks
This commit is contained in:
parent
0275afdfb4
commit
47fde310b1
10 changed files with 374 additions and 56 deletions
|
@ -5,12 +5,15 @@
|
|||
#pragma once
|
||||
|
||||
#include "BrowserPage.g.h"
|
||||
#include "Bookmark.g.h"
|
||||
#include "ConsoleLog.g.h"
|
||||
#include "ServoControl/ServoControl.h"
|
||||
#include "Devtools/Client.h"
|
||||
#include "Bookmarks.h"
|
||||
|
||||
namespace winrt::ServoApp::implementation {
|
||||
|
||||
using namespace winrt::servo;
|
||||
using namespace winrt::Windows;
|
||||
using namespace winrt::Windows::Data::Json;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
|
@ -22,7 +25,7 @@ static const hstring FXR_SCHEME_SLASH_SLASH = L"fxr://";
|
|||
static const hstring FXRMIN_SCHEME = L"fxrmin";
|
||||
static const hstring FXRMIN_SCHEME_SLASH_SLASH = L"fxrmin://";
|
||||
|
||||
struct BrowserPage : BrowserPageT<BrowserPage>, public servo::DevtoolsDelegate {
|
||||
struct BrowserPage : BrowserPageT<BrowserPage>, public DevtoolsDelegate {
|
||||
public:
|
||||
BrowserPage();
|
||||
|
||||
|
@ -32,6 +35,17 @@ public:
|
|||
void OnStopButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnHomeButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnDevtoolsButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnBookmarkClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnUpdateBookmarkButtonClicked(IInspectable const &,
|
||||
RoutedEventArgs const &) {
|
||||
UpdateBookmark();
|
||||
};
|
||||
void OnRemoveBookmarkButtonClicked(IInspectable const &,
|
||||
RoutedEventArgs const &) {
|
||||
RemoveBookmark();
|
||||
};
|
||||
void OnBookmarkEdited(IInspectable const &,
|
||||
Input::KeyRoutedEventArgs const &);
|
||||
void OnJSInputEdited(IInspectable const &, Input::KeyRoutedEventArgs const &);
|
||||
void OnURLEdited(IInspectable const &, Input::KeyRoutedEventArgs const &);
|
||||
void OnSeeAllPrefClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
|
@ -50,11 +64,15 @@ public:
|
|||
RoutedEventArgs const &);
|
||||
void OnPrefererenceSearchboxEdited(IInspectable const &,
|
||||
Input::KeyRoutedEventArgs const &);
|
||||
void OnDevtoolsMessage(servo::DevtoolsMessageLevel, hstring, hstring);
|
||||
void OnDevtoolsMessage(DevtoolsMessageLevel, hstring, hstring);
|
||||
void ClearConsole();
|
||||
void OnDevtoolsDetached();
|
||||
Collections::IObservableVector<IInspectable> ConsoleLogs() { return mLogs; };
|
||||
void BuildPrefList();
|
||||
Collections::IObservableVector<IInspectable> Bookmarks() {
|
||||
return mBookmarks.TemplateSource();
|
||||
};
|
||||
void RemoveBookmark();
|
||||
void UpdateBookmark();
|
||||
|
||||
private:
|
||||
void SetTransientMode(bool);
|
||||
|
@ -63,13 +81,19 @@ private:
|
|||
void BindServoEvents();
|
||||
void ShowToolbox();
|
||||
void HideToolbox();
|
||||
void BuildPrefList();
|
||||
void UpdateBookmarkPanel();
|
||||
void OnBookmarkDBChanged();
|
||||
DevtoolsStatus mDevtoolsStatus = DevtoolsStatus::Stopped;
|
||||
unsigned int mDevtoolsPort = 0;
|
||||
hstring mDevtoolsToken;
|
||||
bool mPanicking = false;
|
||||
std::unique_ptr<servo::DevtoolsClient> mDevtoolsClient;
|
||||
std::unique_ptr<DevtoolsClient> mDevtoolsClient;
|
||||
Collections::IObservableVector<IInspectable> mLogs;
|
||||
std::map<hstring, hstring> mPromotedPrefs;
|
||||
std::optional<hstring> mCurrentUrl;
|
||||
std::optional<hstring> mCurrentTitle;
|
||||
servo::Bookmarks mBookmarks;
|
||||
};
|
||||
|
||||
struct ConsoleLog : ConsoleLogT<ConsoleLog> {
|
||||
|
@ -90,9 +114,21 @@ private:
|
|||
hstring mBody;
|
||||
};
|
||||
|
||||
struct Bookmark : BookmarkT<Bookmark> {
|
||||
public:
|
||||
Bookmark(hstring url, hstring name) : mName(name), mUrl(url){};
|
||||
hstring Name() { return mName; };
|
||||
hstring Url() { return mUrl; };
|
||||
|
||||
private:
|
||||
hstring mName;
|
||||
hstring mUrl;
|
||||
};
|
||||
|
||||
} // namespace winrt::ServoApp::implementation
|
||||
|
||||
namespace winrt::ServoApp::factory_implementation {
|
||||
struct BrowserPage : BrowserPageT<BrowserPage, implementation::BrowserPage> {};
|
||||
struct ConsoleLog : ConsoleLogT<ConsoleLog, implementation::ConsoleLog> {};
|
||||
struct Bookmark : BookmarkT<Bookmark, implementation::Bookmark> {};
|
||||
} // namespace winrt::ServoApp::factory_implementation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue