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

Side by Side Diff: chrome/browser/ui/fullscreen_controller.cc

Issue 10642008: Exit mouse lock permision prompt on tab switch or close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback addressed. Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/fullscreen_controller_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/fullscreen_controller.h" 5 #include "chrome/browser/ui/fullscreen_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 240
241 void FullscreenController::LostMouseLock() { 241 void FullscreenController::LostMouseLock() {
242 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; 242 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED;
243 SetMouseLockTab(NULL); 243 SetMouseLockTab(NULL);
244 NotifyMouseLockChange(); 244 NotifyMouseLockChange();
245 UpdateFullscreenExitBubbleContent(); 245 UpdateFullscreenExitBubbleContent();
246 } 246 }
247 247
248 void FullscreenController::OnTabClosing(WebContents* web_contents) { 248 void FullscreenController::OnTabClosing(WebContents* web_contents) {
249 if (IsFullscreenForTabOrPending(web_contents)) { 249 const TabContents* contents = TabContents::FromWebContents(web_contents);
250 if (contents &&
251 (contents == fullscreened_tab_ || contents == mouse_lock_tab_)) {
250 ExitTabFullscreenOrMouseLockIfNecessary(); 252 ExitTabFullscreenOrMouseLockIfNecessary();
251 // The call to exit fullscreen may result in asynchronous notification of 253 // The call to exit fullscreen may result in asynchronous notification of
252 // fullscreen state change (e.g., on Linux). We don't want to rely on it 254 // fullscreen state change (e.g., on Linux). We don't want to rely on it
253 // to call NotifyTabOfExitIfNecessary(), because at that point 255 // to call NotifyTabOfExitIfNecessary(), because at that point
254 // |fullscreened_tab_| may not be valid. Instead, we call it here to clean 256 // |fullscreened_tab_| may not be valid. Instead, we call it here to clean
255 // up tab fullscreen related state. 257 // up tab fullscreen related state.
256 NotifyTabOfExitIfNecessary(); 258 NotifyTabOfExitIfNecessary();
257 } 259 }
258 } 260 }
259 261
260 void FullscreenController::OnTabDeactivated(TabContents* contents) { 262 void FullscreenController::OnTabDeactivated(TabContents* contents) {
261 if (contents == fullscreened_tab_) 263 if (contents &&
264 (contents == fullscreened_tab_ || contents == mouse_lock_tab_))
262 ExitTabFullscreenOrMouseLockIfNecessary(); 265 ExitTabFullscreenOrMouseLockIfNecessary();
263 } 266 }
264 267
265 void FullscreenController::OnAcceptFullscreenPermission( 268 void FullscreenController::OnAcceptFullscreenPermission(
266 const GURL& url, 269 const GURL& url,
267 FullscreenExitBubbleType bubble_type) { 270 FullscreenExitBubbleType bubble_type) {
268 bool mouse_lock = false; 271 bool mouse_lock = false;
269 bool fullscreen = false; 272 bool fullscreen = false;
270 fullscreen_bubble::PermissionRequestedByType(bubble_type, &fullscreen, 273 fullscreen_bubble::PermissionRequestedByType(bubble_type, &fullscreen,
271 &mouse_lock); 274 &mouse_lock);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 589
587 void FullscreenController::SetFullscreenedTab(TabContents* tab) { 590 void FullscreenController::SetFullscreenedTab(TabContents* tab) {
588 fullscreened_tab_ = tab; 591 fullscreened_tab_ = tab;
589 UpdateNotificationRegistrations(); 592 UpdateNotificationRegistrations();
590 } 593 }
591 594
592 void FullscreenController::SetMouseLockTab(TabContents* tab) { 595 void FullscreenController::SetMouseLockTab(TabContents* tab) {
593 mouse_lock_tab_ = tab; 596 mouse_lock_tab_ = tab;
594 UpdateNotificationRegistrations(); 597 UpdateNotificationRegistrations();
595 } 598 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/fullscreen_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698