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 c9f23650066bef60a09927df8d21aa4945471ba1..65781a5f512b1140f93978fa027cd89290d3d54f 100644 |
--- a/chrome/browser/ui/fullscreen/fullscreen_controller.cc |
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller.cc |
@@ -29,40 +29,33 @@ using content::RenderViewHost; |
using content::UserMetricsAction; |
using content::WebContents; |
-FullscreenController::FullscreenController(BrowserWindow* window, |
- Profile* profile, |
- Browser* browser) |
- : window_(window), |
- profile_(profile), |
- browser_(browser), |
- fullscreened_tab_(NULL), |
- tab_caused_fullscreen_(false), |
- tab_fullscreen_accepted_(false), |
- toggled_into_fullscreen_(false), |
- mouse_lock_tab_(NULL), |
- mouse_lock_state_(MOUSELOCK_NOT_REQUESTED) { |
+FullscreenController::FullscreenController(Browser* browser) |
+ : ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
+ browser_(browser), |
+ window_(browser->window()), |
+ profile_(browser->profile()), |
+ fullscreened_tab_(NULL), |
+ tab_caused_fullscreen_(false), |
+ tab_fullscreen_accepted_(false), |
+ toggled_into_fullscreen_(false), |
+ mouse_lock_tab_(NULL), |
+ mouse_lock_state_(MOUSELOCK_NOT_REQUESTED) { |
+ DCHECK(window_); |
+ DCHECK(profile_); |
} |
-void FullscreenController::Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
- switch (type) { |
- case content::NOTIFICATION_NAV_ENTRY_COMMITTED: |
- if (content::Details<content::LoadCommittedDetails>(details)-> |
- is_navigation_to_different_page()) { |
- ExitTabFullscreenOrMouseLockIfNecessary(); |
- } |
- break; |
- |
- default: |
- NOTREACHED() << "Got a notification we didn't register for."; |
- } |
+FullscreenController::~FullscreenController() { |
} |
bool FullscreenController::IsFullscreenForBrowser() const { |
return window_->IsFullscreen() && !tab_caused_fullscreen_; |
} |
+void FullscreenController::ToggleFullscreenMode() { |
+ extension_caused_fullscreen_ = GURL(); |
+ ToggleFullscreenModeInternal(false); |
+} |
+ |
bool FullscreenController::IsFullscreenForTabOrPending() const { |
return fullscreened_tab_ != NULL; |
} |
@@ -77,81 +70,6 @@ bool FullscreenController::IsFullscreenForTabOrPending( |
return true; |
} |
-#if defined(OS_WIN) |
-bool FullscreenController::IsInMetroSnapMode() { |
- return window_->IsInMetroSnapMode(); |
-} |
-#endif |
- |
-bool FullscreenController::IsMouseLockRequested() const { |
- return mouse_lock_state_ == MOUSELOCK_REQUESTED; |
-} |
- |
-bool FullscreenController::IsMouseLocked() const { |
- return mouse_lock_state_ == MOUSELOCK_ACCEPTED || |
- mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY; |
-} |
- |
-void FullscreenController::RequestToLockMouse(WebContents* web_contents, |
- bool user_gesture, |
- bool last_unlocked_by_target) { |
- DCHECK(!IsMouseLocked()); |
- NotifyMouseLockChange(); |
- |
- // Check for command line switch disabling mouse lock when not tab fullscreen. |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kDisableNonFullscreenMouseLock) && |
- !IsFullscreenForTabOrPending(web_contents)) { |
- web_contents->GotResponseToLockMouseRequest(false); |
- return; |
- } |
- |
- // Must have a user gesture to prevent misbehaving sites from constantly |
- // re-locking the mouse. Exceptions are when the page has unlocked |
- // (i.e. not the user), or if we're in tab fullscreen (user gesture required |
- // for that) |
- if (!last_unlocked_by_target && !user_gesture && |
- !IsFullscreenForTabOrPending(web_contents)) { |
- web_contents->GotResponseToLockMouseRequest(false); |
- return; |
- } |
- SetMouseLockTab(TabContents::FromWebContents(web_contents)); |
- FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType(); |
- |
- switch (GetMouseLockSetting(web_contents->GetURL())) { |
- 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)) { |
- mouse_lock_state_ = MOUSELOCK_REQUESTED; |
- } else { |
- // Lock mouse. |
- if (web_contents->GotResponseToLockMouseRequest(true)) { |
- if (last_unlocked_by_target) { |
- mouse_lock_state_ = MOUSELOCK_ACCEPTED_SILENTLY; |
- } else { |
- mouse_lock_state_ = MOUSELOCK_ACCEPTED; |
- } |
- } else { |
- SetMouseLockTab(NULL); |
- mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
- } |
- } |
- break; |
- case CONTENT_SETTING_BLOCK: |
- web_contents->GotResponseToLockMouseRequest(false); |
- SetMouseLockTab(NULL); |
- mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
- break; |
- case CONTENT_SETTING_ASK: |
- mouse_lock_state_ = MOUSELOCK_REQUESTED; |
- break; |
- default: |
- NOTREACHED(); |
- } |
- UpdateFullscreenExitBubbleContent(); |
-} |
- |
void FullscreenController::ToggleFullscreenModeForTab(WebContents* web_contents, |
bool enter_fullscreen) { |
if (web_contents != chrome::GetActiveWebContents(browser_)) |
@@ -212,12 +130,24 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* web_contents, |
} |
} |
+void FullscreenController::ToggleFullscreenModeWithExtension( |
+ const GURL& extension_url) { |
+ // |extension_caused_fullscreen_| will be reset if this causes fullscreen to |
+ // exit. |
+ extension_caused_fullscreen_ = extension_url; |
+ ToggleFullscreenModeInternal(false); |
+} |
+ |
#if defined(OS_WIN) |
+bool FullscreenController::IsInMetroSnapMode() { |
+ return window_->IsInMetroSnapMode(); |
+} |
+ |
void FullscreenController::SetMetroSnapMode(bool enable) { |
toggled_into_fullscreen_ = false; |
window_->SetMetroSnapMode(enable); |
} |
-#endif |
+#endif // defined(OS_WIN) |
#if defined(OS_MACOSX) |
void FullscreenController::TogglePresentationMode() { |
@@ -225,26 +155,82 @@ void FullscreenController::TogglePresentationMode() { |
} |
#endif |
-void FullscreenController::ToggleFullscreenMode() { |
- extension_caused_fullscreen_ = GURL(); |
- ToggleFullscreenModeInternal(false); |
+bool FullscreenController::IsMouseLockRequested() const { |
+ return mouse_lock_state_ == MOUSELOCK_REQUESTED; |
} |
-void FullscreenController::ToggleFullscreenModeWithExtension( |
- const GURL& extension_url) { |
- // |extension_caused_fullscreen_| will be reset if this causes fullscreen to |
- // exit. |
- extension_caused_fullscreen_ = extension_url; |
- ToggleFullscreenModeInternal(false); |
+bool FullscreenController::IsMouseLocked() const { |
+ return mouse_lock_state_ == MOUSELOCK_ACCEPTED || |
+ mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY; |
} |
-void FullscreenController::LostMouseLock() { |
- mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
- SetMouseLockTab(NULL); |
+void FullscreenController::RequestToLockMouse(WebContents* web_contents, |
+ bool user_gesture, |
+ bool last_unlocked_by_target) { |
+ DCHECK(!IsMouseLocked()); |
NotifyMouseLockChange(); |
+ |
+ // Check for command line switch disabling mouse lock when not tab fullscreen. |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableNonFullscreenMouseLock) && |
+ !IsFullscreenForTabOrPending(web_contents)) { |
+ web_contents->GotResponseToLockMouseRequest(false); |
+ return; |
+ } |
+ |
+ // Must have a user gesture to prevent misbehaving sites from constantly |
+ // re-locking the mouse. Exceptions are when the page has unlocked |
+ // (i.e. not the user), or if we're in tab fullscreen (user gesture required |
+ // for that) |
+ if (!last_unlocked_by_target && !user_gesture && |
+ !IsFullscreenForTabOrPending(web_contents)) { |
+ web_contents->GotResponseToLockMouseRequest(false); |
+ return; |
+ } |
+ SetMouseLockTab(TabContents::FromWebContents(web_contents)); |
+ FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType(); |
+ |
+ switch (GetMouseLockSetting(web_contents->GetURL())) { |
+ 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)) { |
+ mouse_lock_state_ = MOUSELOCK_REQUESTED; |
+ } else { |
+ // Lock mouse. |
+ if (web_contents->GotResponseToLockMouseRequest(true)) { |
+ if (last_unlocked_by_target) { |
+ mouse_lock_state_ = MOUSELOCK_ACCEPTED_SILENTLY; |
+ } else { |
+ mouse_lock_state_ = MOUSELOCK_ACCEPTED; |
+ } |
+ } else { |
+ SetMouseLockTab(NULL); |
+ mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
+ } |
+ } |
+ break; |
+ case CONTENT_SETTING_BLOCK: |
+ web_contents->GotResponseToLockMouseRequest(false); |
+ SetMouseLockTab(NULL); |
+ mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
+ break; |
+ case CONTENT_SETTING_ASK: |
+ mouse_lock_state_ = MOUSELOCK_REQUESTED; |
+ break; |
+ default: |
+ NOTREACHED(); |
+ } |
UpdateFullscreenExitBubbleContent(); |
} |
+void FullscreenController::OnTabDeactivated(TabContents* contents) { |
+ if (contents && |
+ (contents == fullscreened_tab_ || contents == mouse_lock_tab_)) { |
+ ExitTabFullscreenOrMouseLockIfNecessary(); |
+ } |
+} |
+ |
void FullscreenController::OnTabClosing(WebContents* web_contents) { |
const TabContents* contents = TabContents::FromWebContents(web_contents); |
if (contents && |
@@ -259,10 +245,32 @@ void FullscreenController::OnTabClosing(WebContents* web_contents) { |
} |
} |
-void FullscreenController::OnTabDeactivated(TabContents* contents) { |
- if (contents && |
- (contents == fullscreened_tab_ || contents == mouse_lock_tab_)) |
+void FullscreenController::WindowFullscreenStateChanged() { |
+ bool exiting_fullscreen; |
+#if defined(OS_MACOSX) |
+ exiting_fullscreen = !window_->InPresentationMode(); |
+#else |
+ exiting_fullscreen = !window_->IsFullscreen(); |
+#endif |
+ MessageLoop::current()->PostTask(FROM_HERE, |
+ base::Bind(&FullscreenController::NotifyFullscreenChange, |
+ ptr_factory_.GetWeakPtr(), !exiting_fullscreen)); |
+ if (exiting_fullscreen) |
+ NotifyTabOfExitIfNecessary(); |
+ if (exiting_fullscreen) |
+ window_->GetDownloadShelf()->Unhide(); |
+ else |
+ window_->GetDownloadShelf()->Hide(); |
+} |
+ |
+bool FullscreenController::HandleUserPressedEscape() { |
+ if (IsFullscreenForTabOrPending() || |
+ IsMouseLocked() || IsMouseLockRequested()) { |
ExitTabFullscreenOrMouseLockIfNecessary(); |
+ return true; |
+ } |
+ |
+ return false; |
} |
void FullscreenController::OnAcceptFullscreenPermission( |
@@ -341,121 +349,27 @@ void FullscreenController::OnDenyFullscreenPermission( |
ExitTabFullscreenOrMouseLockIfNecessary(); |
} |
-void FullscreenController::WindowFullscreenStateChanged() { |
- bool exiting_fullscreen; |
-#if defined(OS_MACOSX) |
- exiting_fullscreen = !window_->InPresentationMode(); |
-#else |
- exiting_fullscreen = !window_->IsFullscreen(); |
-#endif |
- MessageLoop::current()->PostTask(FROM_HERE, |
- base::Bind(&FullscreenController::NotifyFullscreenChange, |
- this, !exiting_fullscreen)); |
- if (exiting_fullscreen) |
- NotifyTabOfExitIfNecessary(); |
- if (exiting_fullscreen) |
- window_->GetDownloadShelf()->Unhide(); |
- else |
- window_->GetDownloadShelf()->Hide(); |
-} |
- |
-bool FullscreenController::HandleUserPressedEscape() { |
- if (IsFullscreenForTabOrPending() || |
- IsMouseLocked() || IsMouseLockRequested()) { |
- ExitTabFullscreenOrMouseLockIfNecessary(); |
- return true; |
- } |
- |
- return false; |
-} |
- |
-FullscreenController::~FullscreenController() {} |
- |
-void FullscreenController::NotifyTabOfExitIfNecessary() { |
- if (fullscreened_tab_) { |
- RenderViewHost* rvh = |
- fullscreened_tab_->web_contents()->GetRenderViewHost(); |
- SetFullscreenedTab(NULL); |
- tab_caused_fullscreen_ = false; |
- tab_fullscreen_accepted_ = false; |
- if (rvh) |
- rvh->ExitFullscreen(); |
- } |
- |
- if (mouse_lock_tab_) { |
- WebContents* web_contents = mouse_lock_tab_->web_contents(); |
- if (IsMouseLockRequested()) { |
- web_contents->GotResponseToLockMouseRequest(false); |
- NotifyMouseLockChange(); |
- } else if (web_contents->GetRenderViewHost() && |
- web_contents->GetRenderViewHost()->GetView()) { |
- web_contents->GetRenderViewHost()->GetView()->UnlockMouse(); |
- } |
- SetMouseLockTab(NULL); |
- mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
- } |
- |
+void FullscreenController::LostMouseLock() { |
+ mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
+ SetMouseLockTab(NULL); |
+ NotifyMouseLockChange(); |
UpdateFullscreenExitBubbleContent(); |
} |
-void FullscreenController::UpdateNotificationRegistrations() { |
- if (fullscreened_tab_ && mouse_lock_tab_) |
- DCHECK(fullscreened_tab_ == mouse_lock_tab_); |
- |
- TabContents* tab = fullscreened_tab_ ? fullscreened_tab_ : mouse_lock_tab_; |
- |
- if (tab && registrar_.IsEmpty()) { |
- registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
- content::Source<content::NavigationController>( |
- &tab->web_contents()->GetController())); |
- } else if (!tab && !registrar_.IsEmpty()) { |
- registrar_.RemoveAll(); |
- } |
-} |
- |
-void FullscreenController::ExitTabFullscreenOrMouseLockIfNecessary() { |
- if (tab_caused_fullscreen_) |
- ToggleFullscreenMode(); |
- else |
- NotifyTabOfExitIfNecessary(); |
-} |
- |
-void FullscreenController::UpdateFullscreenExitBubbleContent() { |
- GURL url; |
- if (fullscreened_tab_) |
- url = fullscreened_tab_->web_contents()->GetURL(); |
- else if (mouse_lock_tab_) |
- url = mouse_lock_tab_->web_contents()->GetURL(); |
- else if (!extension_caused_fullscreen_.is_empty()) |
- url = extension_caused_fullscreen_; |
- |
- FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType(); |
+void FullscreenController::Observe(int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) { |
+ switch (type) { |
+ case content::NOTIFICATION_NAV_ENTRY_COMMITTED: |
+ if (content::Details<content::LoadCommittedDetails>(details)-> |
+ is_navigation_to_different_page()) { |
+ ExitTabFullscreenOrMouseLockIfNecessary(); |
+ } |
+ break; |
- // If bubble displays buttons, unlock mouse to allow pressing them. |
- if (fullscreen_bubble::ShowButtonsForType(bubble_type) && |
- IsMouseLocked() && |
- mouse_lock_tab_->web_contents()) { |
- WebContents* web_contents = mouse_lock_tab_->web_contents(); |
- if (web_contents && web_contents->GetRenderViewHost() && |
- web_contents->GetRenderViewHost()->GetView()) |
- web_contents->GetRenderViewHost()->GetView()->UnlockMouse(); |
+ default: |
+ NOTREACHED() << "Got a notification we didn't register for."; |
} |
- |
- window_->UpdateFullscreenExitBubbleContent(url, bubble_type); |
-} |
- |
-void FullscreenController::NotifyFullscreenChange(bool is_fullscreen) { |
- content::NotificationService::current()->Notify( |
- chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
- content::Source<FullscreenController>(this), |
- content::Details<bool>(&is_fullscreen)); |
-} |
- |
-void FullscreenController::NotifyMouseLockChange() { |
- content::NotificationService::current()->Notify( |
- chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
- content::Source<FullscreenController>(this), |
- content::NotificationService::NoDetails()); |
} |
FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType() |
@@ -506,44 +420,61 @@ FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType() |
return FEB_TYPE_NONE; |
} |
-ContentSetting |
- FullscreenController::GetFullscreenSetting(const GURL& url) const { |
- if (url.SchemeIsFile()) |
- return CONTENT_SETTING_ALLOW; |
+void FullscreenController::UpdateNotificationRegistrations() { |
+ if (fullscreened_tab_ && mouse_lock_tab_) |
+ DCHECK(fullscreened_tab_ == mouse_lock_tab_); |
- return profile_->GetHostContentSettingsMap()->GetContentSetting(url, url, |
- CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string()); |
-} |
+ TabContents* tab = fullscreened_tab_ ? fullscreened_tab_ : mouse_lock_tab_; |
-ContentSetting |
- FullscreenController::GetMouseLockSetting(const GURL& url) const { |
- if (url.SchemeIsFile()) |
- return CONTENT_SETTING_ALLOW; |
+ if (tab && registrar_.IsEmpty()) { |
+ registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
+ content::Source<content::NavigationController>( |
+ &tab->web_contents()->GetController())); |
+ } else if (!tab && !registrar_.IsEmpty()) { |
+ registrar_.RemoveAll(); |
+ } |
+} |
- HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
- return settings_map->GetContentSetting(url, url, |
- CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
+void FullscreenController::NotifyFullscreenChange(bool is_fullscreen) { |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
+ content::Source<FullscreenController>(this), |
+ content::Details<bool>(&is_fullscreen)); |
} |
-#if defined(OS_MACOSX) |
-void FullscreenController::TogglePresentationModeInternal(bool for_tab) { |
- toggled_into_fullscreen_ = !window_->InPresentationMode(); |
- GURL url; |
- if (for_tab) { |
- url = chrome::GetActiveWebContents(browser_)->GetURL(); |
- tab_fullscreen_accepted_ = toggled_into_fullscreen_ && |
- GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
+void FullscreenController::NotifyTabOfExitIfNecessary() { |
+ if (fullscreened_tab_) { |
+ RenderViewHost* rvh = |
+ fullscreened_tab_->web_contents()->GetRenderViewHost(); |
+ SetFullscreenedTab(NULL); |
+ tab_caused_fullscreen_ = false; |
+ tab_fullscreen_accepted_ = false; |
+ if (rvh) |
+ rvh->ExitFullscreen(); |
} |
- if (toggled_into_fullscreen_) |
- window_->EnterPresentationMode(url, GetFullscreenExitBubbleType()); |
- else |
- window_->ExitPresentationMode(); |
+ |
+ if (mouse_lock_tab_) { |
+ WebContents* web_contents = mouse_lock_tab_->web_contents(); |
+ if (IsMouseLockRequested()) { |
+ web_contents->GotResponseToLockMouseRequest(false); |
+ NotifyMouseLockChange(); |
+ } else if (web_contents->GetRenderViewHost() && |
+ web_contents->GetRenderViewHost()->GetView()) { |
+ web_contents->GetRenderViewHost()->GetView()->UnlockMouse(); |
+ } |
+ SetMouseLockTab(NULL); |
+ mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
+ } |
+ |
UpdateFullscreenExitBubbleContent(); |
+} |
- // WindowFullscreenStateChanged will be called by BrowserWindowController |
- // when the transition completes. |
+void FullscreenController::NotifyMouseLockChange() { |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
+ content::Source<FullscreenController>(this), |
+ content::NotificationService::NoDetails()); |
} |
-#endif |
// TODO(koz): Change |for_tab| to an enum. |
void FullscreenController::ToggleFullscreenModeInternal(bool for_tab) { |
@@ -585,6 +516,26 @@ void FullscreenController::ToggleFullscreenModeInternal(bool for_tab) { |
// the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. |
} |
+#if defined(OS_MACOSX) |
+void FullscreenController::TogglePresentationModeInternal(bool for_tab) { |
+ toggled_into_fullscreen_ = !window_->InPresentationMode(); |
+ GURL url; |
+ if (for_tab) { |
+ url = chrome::GetActiveWebContents(browser_)->GetURL(); |
+ tab_fullscreen_accepted_ = toggled_into_fullscreen_ && |
+ GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
+ } |
+ if (toggled_into_fullscreen_) |
+ window_->EnterPresentationMode(url, GetFullscreenExitBubbleType()); |
+ else |
+ window_->ExitPresentationMode(); |
+ UpdateFullscreenExitBubbleContent(); |
+ |
+ // WindowFullscreenStateChanged will be called by BrowserWindowController |
+ // when the transition completes. |
+} |
+#endif |
+ |
void FullscreenController::SetFullscreenedTab(TabContents* tab) { |
fullscreened_tab_ = tab; |
UpdateNotificationRegistrations(); |
@@ -594,3 +545,53 @@ void FullscreenController::SetMouseLockTab(TabContents* tab) { |
mouse_lock_tab_ = tab; |
UpdateNotificationRegistrations(); |
} |
+ |
+void FullscreenController::ExitTabFullscreenOrMouseLockIfNecessary() { |
+ if (tab_caused_fullscreen_) |
+ ToggleFullscreenMode(); |
+ else |
+ NotifyTabOfExitIfNecessary(); |
+} |
+ |
+void FullscreenController::UpdateFullscreenExitBubbleContent() { |
+ GURL url; |
+ if (fullscreened_tab_) |
+ url = fullscreened_tab_->web_contents()->GetURL(); |
+ else if (mouse_lock_tab_) |
+ url = mouse_lock_tab_->web_contents()->GetURL(); |
+ else if (!extension_caused_fullscreen_.is_empty()) |
+ url = extension_caused_fullscreen_; |
+ |
+ FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType(); |
+ |
+ // If bubble displays buttons, unlock mouse to allow pressing them. |
+ if (fullscreen_bubble::ShowButtonsForType(bubble_type) && |
+ IsMouseLocked() && |
+ mouse_lock_tab_->web_contents()) { |
+ WebContents* web_contents = mouse_lock_tab_->web_contents(); |
+ if (web_contents && web_contents->GetRenderViewHost() && |
+ web_contents->GetRenderViewHost()->GetView()) |
+ web_contents->GetRenderViewHost()->GetView()->UnlockMouse(); |
+ } |
+ |
+ window_->UpdateFullscreenExitBubbleContent(url, bubble_type); |
+} |
+ |
+ContentSetting |
+ FullscreenController::GetFullscreenSetting(const GURL& url) const { |
+ if (url.SchemeIsFile()) |
+ return CONTENT_SETTING_ALLOW; |
+ |
+ return profile_->GetHostContentSettingsMap()->GetContentSetting(url, url, |
+ CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string()); |
+} |
+ |
+ContentSetting |
+ FullscreenController::GetMouseLockSetting(const GURL& url) const { |
+ if (url.SchemeIsFile()) |
+ return CONTENT_SETTING_ALLOW; |
+ |
+ HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
+ return settings_map->GetContentSetting(url, url, |
+ CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
+} |