Index: chrome/browser/ui/fullscreen_controller.cc |
diff --git a/chrome/browser/ui/fullscreen_controller.cc b/chrome/browser/ui/fullscreen_controller.cc |
index 7702c654fa78ee65cfa98afc32b78e0ac1163156..9136131d8f1a74073ed1d51ffeaa21c01c4b7608 100644 |
--- a/chrome/browser/ui/fullscreen_controller.cc |
+++ b/chrome/browser/ui/fullscreen_controller.cc |
@@ -246,7 +246,9 @@ void FullscreenController::LostMouseLock() { |
} |
void FullscreenController::OnTabClosing(WebContents* web_contents) { |
- if (IsFullscreenForTabOrPending(web_contents)) { |
+ const TabContents* contents = TabContents::FromWebContents(web_contents); |
+ if (contents && |
+ (contents == fullscreened_tab_ || contents == mouse_lock_tab_)) { |
ExitTabFullscreenOrMouseLockIfNecessary(); |
// The call to exit fullscreen may result in asynchronous notification of |
// fullscreen state change (e.g., on Linux). We don't want to rely on it |
@@ -258,7 +260,8 @@ void FullscreenController::OnTabClosing(WebContents* web_contents) { |
} |
void FullscreenController::OnTabDeactivated(TabContents* contents) { |
- if (contents == fullscreened_tab_) |
+ if (contents && |
+ (contents == fullscreened_tab_ || contents == mouse_lock_tab_)) |
ExitTabFullscreenOrMouseLockIfNecessary(); |
} |