Bug 1105939 part 5 - Rename parameter aRequireTrust of SetFullScreenInternal to aFullscreenMode for increased clarity. r=smaug

This commit is contained in:
Xidorn Quan 2015-06-04 13:49:34 +12:00
parent 64c6300441
commit 8cd61a5e8c
3 changed files with 12 additions and 12 deletions

View File

@ -6046,16 +6046,17 @@ nsGlobalWindow::SetFullScreen(bool aFullScreen)
}
nsresult
nsGlobalWindow::SetFullScreenInternal(bool aFullScreen, bool aRequireTrust, gfx::VRHMDInfo* aHMD)
nsGlobalWindow::SetFullScreenInternal(bool aFullScreen, bool aFullscreenMode,
gfx::VRHMDInfo* aHMD)
{
MOZ_ASSERT(IsOuterWindow());
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
// Only chrome can change our fullScreen mode, unless we're running in
// untrusted mode.
// Only chrome can change our fullscreen mode. Otherwise, the state
// can only be changed for DOM fullscreen.
if (aFullScreen == FullScreen() ||
(aRequireTrust && !nsContentUtils::IsCallerChrome())) {
(aFullscreenMode && !nsContentUtils::IsCallerChrome())) {
return NS_OK;
}
@ -6068,7 +6069,7 @@ nsGlobalWindow::SetFullScreenInternal(bool aFullScreen, bool aRequireTrust, gfx:
if (!window)
return NS_ERROR_FAILURE;
if (rootItem != mDocShell)
return window->SetFullScreenInternal(aFullScreen, aRequireTrust, aHMD);
return window->SetFullScreenInternal(aFullScreen, aFullscreenMode, aHMD);
// make sure we don't try to set full screen on a non-chrome window,
// which might happen in embedding world
@ -6079,12 +6080,10 @@ nsGlobalWindow::SetFullScreenInternal(bool aFullScreen, bool aRequireTrust, gfx:
if (mFullScreen == aFullScreen)
return NS_OK;
// If a fullscreen is originated from chrome, we are switching to
// the fullscreen mode, otherwise, we are entering DOM fullscreen.
// Note that although entering DOM fullscreen could also cause
// consequential calls to this method, those calls will be skipped
// at the condition above.
if (aRequireTrust) {
if (aFullscreenMode) {
mFullscreenMode = aFullScreen;
} else {
// If we are exiting from DOM fullscreen while we

View File

@ -490,7 +490,7 @@ public:
virtual void RefreshCompartmentPrincipal() override;
// Outer windows only.
virtual nsresult SetFullScreenInternal(bool aIsFullScreen, bool aRequireTrust,
virtual nsresult SetFullScreenInternal(bool aIsFullscreen, bool aFullscreenMode,
mozilla::gfx::VRHMDInfo *aHMD = nullptr) override;
bool FullScreen() const;

View File

@ -463,15 +463,16 @@ public:
/**
* Moves the top-level window into fullscreen mode if aIsFullScreen is true,
* otherwise exits fullscreen. If aRequireTrust is true, this method only
* changes window state in a context trusted for write.
* otherwise exits fullscreen. If aFullscreenMode is true, this method is
* called for fullscreen mode instead of DOM fullscreen, which means it can
* only change window state in a context trusted for write.
*
* If aHMD is not null, the window is made full screen on the given VR HMD
* device instead of its currrent display.
*
* Outer windows only.
*/
virtual nsresult SetFullScreenInternal(bool aIsFullScreen, bool aRequireTrust,
virtual nsresult SetFullScreenInternal(bool aIsFullscreen, bool aFullscreenMode,
mozilla::gfx::VRHMDInfo *aHMD = nullptr) = 0;
/**