Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: chrome/browser/ui/fullscreen/fullscreen_controller.cc

Issue 23477051: Embed Flash Fullscreen widget within browser window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rolled WebContentsObserver into WebView. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()) {
yzshen1 2013/09/12 18:39:43 It is better not to put part of the if...else if..
miu 2013/09/12 23:16:44 Done. I was attempting to clean things up to be m
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();
+}

Powered by Google App Engine
This is Rietveld 408576698