Handle servo:// url

This commit is contained in:
Paul Rouget 2019-08-20 07:28:00 +02:00
parent 5f89dc87bd
commit 5c1d130217
10 changed files with 91 additions and 40 deletions

View file

@ -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>();