| Index: chrome/browser/ui/fullscreen/fullscreen_controller.cc
|
| diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller.cc b/chrome/browser/ui/fullscreen/fullscreen_controller.cc
|
| index d275cfe69950c57cab05096e8fadd071daea269c..017e288f4eaf91b87f06a95fbbe8daddd74ed476 100644
|
| --- a/chrome/browser/ui/fullscreen/fullscreen_controller.cc
|
| +++ b/chrome/browser/ui/fullscreen/fullscreen_controller.cc
|
| @@ -103,22 +103,16 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* web_contents,
|
| #endif
|
|
|
| bool in_browser_or_tab_fullscreen_mode = window_->IsFullscreen();
|
| - bool window_is_fullscreen_with_chrome = false;
|
| -#if defined(OS_MACOSX)
|
| - window_is_fullscreen_with_chrome = window_->IsFullscreenWithChrome();
|
| -#endif
|
|
|
| if (enter_fullscreen) {
|
| SetFullscreenedTab(web_contents);
|
| if (!in_browser_or_tab_fullscreen_mode) {
|
| state_prior_to_tab_fullscreen_ = STATE_NORMAL;
|
| ToggleFullscreenModeInternal(TAB);
|
| - } else if (window_is_fullscreen_with_chrome) {
|
| #if defined(OS_MACOSX)
|
| + } else if (window_->IsFullscreenWithChrome()) {
|
| state_prior_to_tab_fullscreen_ = STATE_BROWSER_FULLSCREEN_WITH_CHROME;
|
| EnterFullscreenModeInternal(TAB);
|
| -#else
|
| - NOTREACHED();
|
| #endif
|
| } else {
|
| state_prior_to_tab_fullscreen_ = STATE_BROWSER_FULLSCREEN_NO_CHROME;
|
| @@ -235,7 +229,8 @@ void FullscreenController::RequestToLockMouse(WebContents* web_contents,
|
| case CONTENT_SETTING_ALLOW:
|
| // If bubble already displaying buttons we must not lock the mouse yet,
|
| // or it would prevent pressing those buttons. Instead, merge the request.
|
| - if (fullscreen_bubble::ShowButtonsForType(bubble_type)) {
|
| + if (!IsPrivilegedFullscreenForTab() &&
|
| + fullscreen_bubble::ShowButtonsForType(bubble_type)) {
|
| mouse_lock_state_ = MOUSELOCK_REQUESTED;
|
| } else {
|
| // Lock mouse.
|
| @@ -511,9 +506,8 @@ void FullscreenController::NotifyTabOfExitIfNecessary() {
|
| if (IsMouseLockRequested()) {
|
| mouse_lock_tab_->GotResponseToLockMouseRequest(false);
|
| NotifyMouseLockChange();
|
| - } else if (mouse_lock_tab_->GetRenderViewHost() &&
|
| - mouse_lock_tab_->GetRenderViewHost()->GetView()) {
|
| - mouse_lock_tab_->GetRenderViewHost()->GetView()->UnlockMouse();
|
| + } else {
|
| + UnlockMouse();
|
| }
|
| SetMouseLockTab(NULL);
|
| mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED;
|
| @@ -529,7 +523,6 @@ void FullscreenController::NotifyMouseLockChange() {
|
| content::NotificationService::NoDetails());
|
| }
|
|
|
| -// TODO(koz): Change |for_tab| to an enum.
|
| void FullscreenController::ToggleFullscreenModeInternal(
|
| FullscreenInternalOption option) {
|
| #if defined(OS_WIN)
|
| @@ -644,20 +637,15 @@ void FullscreenController::UpdateFullscreenExitBubbleContent() {
|
| FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType();
|
|
|
| // If bubble displays buttons, unlock mouse to allow pressing them.
|
| - if (fullscreen_bubble::ShowButtonsForType(bubble_type) &&
|
| - IsMouseLocked() &&
|
| - mouse_lock_tab_ &&
|
| - mouse_lock_tab_->GetRenderViewHost() &&
|
| - mouse_lock_tab_->GetRenderViewHost()->GetView()) {
|
| - mouse_lock_tab_->GetRenderViewHost()->GetView()->UnlockMouse();
|
| - }
|
| + if (fullscreen_bubble::ShowButtonsForType(bubble_type) && IsMouseLocked())
|
| + UnlockMouse();
|
|
|
| window_->UpdateFullscreenExitBubbleContent(url, bubble_type);
|
| }
|
|
|
| ContentSetting
|
| FullscreenController::GetFullscreenSetting(const GURL& url) const {
|
| - if (url.SchemeIsFile())
|
| + if (IsPrivilegedFullscreenForTab() || url.SchemeIsFile())
|
| return CONTENT_SETTING_ALLOW;
|
|
|
| return profile_->GetHostContentSettingsMap()->GetContentSetting(url, url,
|
| @@ -666,10 +654,32 @@ FullscreenController::GetFullscreenSetting(const GURL& url) const {
|
|
|
| ContentSetting
|
| FullscreenController::GetMouseLockSetting(const GURL& url) const {
|
| - if (url.SchemeIsFile())
|
| + if (IsPrivilegedFullscreenForTab() || url.SchemeIsFile())
|
| return CONTENT_SETTING_ALLOW;
|
|
|
| HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap();
|
| return settings_map->GetContentSetting(url, url,
|
| CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string());
|
| }
|
| +
|
| +bool FullscreenController::IsPrivilegedFullscreenForTab() const {
|
| + return fullscreened_tab_ &&
|
| + fullscreened_tab_->GetFullscreenRenderWidgetHostView() &&
|
| + implicit_cast<const content::WebContentsDelegate*>(browser_)->
|
| + EmbedsFullscreenWidget();
|
| +}
|
| +
|
| +void FullscreenController::UnlockMouse() {
|
| + if (!mouse_lock_tab_)
|
| + return;
|
| + content::RenderWidgetHostView* mouse_lock_view =
|
| + (fullscreened_tab_ == mouse_lock_tab_ && IsPrivilegedFullscreenForTab()) ?
|
| + mouse_lock_tab_->GetFullscreenRenderWidgetHostView() : NULL;
|
| + if (!mouse_lock_view) {
|
| + RenderViewHost* const rvh = mouse_lock_tab_->GetRenderViewHost();
|
| + if (rvh)
|
| + mouse_lock_view = rvh->GetView();
|
| + }
|
| + if (mouse_lock_view)
|
| + mouse_lock_view->UnlockMouse();
|
| +}
|
|
|