mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #27287 - paulrouget:fxrmin, r=jdm
Make it possible to run fxr:// url in non-kiosk mode Fix #27274
This commit is contained in:
commit
9daadd03cc
4 changed files with 25 additions and 16 deletions
|
@ -95,10 +95,7 @@ void App::OnActivated(IActivatedEventArgs const &args) {
|
|||
rootFrame = content.try_as<Frame>();
|
||||
}
|
||||
auto page = rootFrame.Content().try_as<BrowserPage>();
|
||||
page->LoadServoURI(protocolActivatedEventArgs.Uri());
|
||||
// If Servo was opened as a result of clicking on a fxr:// URL,
|
||||
// we activate transient mode.
|
||||
page->SetTransientMode(!isRunning);
|
||||
page->LoadFXRURI(protocolActivatedEventArgs.Uri());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,16 +99,20 @@ void BrowserPage::OnURLKeyboardAccelerator(
|
|||
urlTextbox().Focus(FocusState::Programmatic);
|
||||
}
|
||||
|
||||
void BrowserPage::LoadServoURI(Uri uri) {
|
||||
void BrowserPage::LoadFXRURI(Uri uri) {
|
||||
auto scheme = uri.SchemeName();
|
||||
|
||||
if (scheme != SERVO_SCHEME) {
|
||||
log(L"Unexpected URL: ", uri.RawUri().c_str());
|
||||
return;
|
||||
}
|
||||
std::wstring raw{uri.RawUri()};
|
||||
auto raw2 = raw.substr(SERVO_SCHEME_SLASH_SLASH.size());
|
||||
servoControl().LoadURIOrSearch(raw2);
|
||||
if (scheme == FXR_SCHEME) {
|
||||
auto raw2 = raw.substr(FXR_SCHEME_SLASH_SLASH.size());
|
||||
servoControl().LoadURIOrSearch(raw2);
|
||||
SetTransientMode(false);
|
||||
} else if (scheme == FXRMIN_SCHEME) {
|
||||
auto raw2 = raw.substr(FXRMIN_SCHEME_SLASH_SLASH.size());
|
||||
servoControl().LoadURIOrSearch(raw2);
|
||||
SetTransientMode(true);
|
||||
} else {
|
||||
log(L"Unexpected URL: ", uri.RawUri().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserPage::SetTransientMode(bool transient) {
|
||||
|
|
|
@ -17,8 +17,10 @@ using namespace winrt::Windows::Foundation;
|
|||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Xaml::Media;
|
||||
|
||||
static const hstring SERVO_SCHEME = L"fxr";
|
||||
static const hstring SERVO_SCHEME_SLASH_SLASH = L"fxr://";
|
||||
static const hstring FXR_SCHEME = L"fxr";
|
||||
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 {
|
||||
public:
|
||||
|
@ -37,8 +39,7 @@ public:
|
|||
OnURLKeyboardAccelerator(IInspectable const &,
|
||||
Input::KeyboardAcceleratorInvokedEventArgs const &);
|
||||
void Shutdown();
|
||||
void LoadServoURI(Uri uri);
|
||||
void SetTransientMode(bool);
|
||||
void LoadFXRURI(Uri uri);
|
||||
void SetArgs(hstring);
|
||||
void OnMediaControlsPlayClicked(IInspectable const &,
|
||||
RoutedEventArgs const &);
|
||||
|
@ -52,6 +53,7 @@ public:
|
|||
Collections::IObservableVector<IInspectable> ConsoleLogs() { return mLogs; };
|
||||
|
||||
private:
|
||||
void SetTransientMode(bool);
|
||||
void UpdatePref(ServoApp::Pref, Controls::Control);
|
||||
void BindServoEvents();
|
||||
void BuildPrefList();
|
||||
|
|
|
@ -38,6 +38,12 @@
|
|||
<uap:DisplayName>Firefox Reality URL</uap:DisplayName>
|
||||
</uap:Protocol>
|
||||
</uap:Extension>
|
||||
<uap:Extension Category="windows.protocol">
|
||||
<uap:Protocol Name="fxrmin">
|
||||
<uap:Logo>Assets\StoreLogo.png</uap:Logo>
|
||||
<uap:DisplayName>Firefox Reality URL (Kiosk mode)</uap:DisplayName>
|
||||
</uap:Protocol>
|
||||
</uap:Extension>
|
||||
</Extensions>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue