mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Handle servo:// url
This commit is contained in:
parent
5f89dc87bd
commit
5c1d130217
10 changed files with 91 additions and 40 deletions
|
@ -62,8 +62,29 @@ void App::OnLaunched(LaunchActivatedEventArgs const &e) {
|
|||
}
|
||||
}
|
||||
|
||||
void App::OnSuspending([[maybe_unused]] IInspectable const &sender,
|
||||
[[maybe_unused]] SuspendingEventArgs const &e) {
|
||||
void App::OnActivated(IActivatedEventArgs const &args) {
|
||||
if (args.Kind() ==
|
||||
Windows::ApplicationModel::Activation::ActivationKind::Protocol) {
|
||||
auto protocolActivatedEventArgs{args.as<
|
||||
Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs>()};
|
||||
|
||||
Frame rootFrame{nullptr};
|
||||
|
||||
auto content = Window::Current().Content();
|
||||
if (content == nullptr) {
|
||||
rootFrame = Frame();
|
||||
rootFrame.Navigate(xaml_typename<ServoApp::BrowserPage>());
|
||||
Window::Current().Content(rootFrame);
|
||||
Window::Current().Activate();
|
||||
} else {
|
||||
rootFrame = content.try_as<Frame>();
|
||||
}
|
||||
auto page = rootFrame.Content().try_as<BrowserPage>();
|
||||
page->LoadServoURI(protocolActivatedEventArgs.Uri());
|
||||
}
|
||||
}
|
||||
|
||||
void App::OnSuspending(IInspectable const &, SuspendingEventArgs const &) {
|
||||
auto content = Window::Current().Content();
|
||||
Frame rootFrame = content.try_as<Frame>();
|
||||
auto page = rootFrame.Content().try_as<BrowserPage>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue