Chromium Code Reviews| Index: chrome/browser/ui/browser_command_controller.cc |
| diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc |
| index 8ef341eebff00bfd37a544c5d4cfc7c5120054ff..34d936d13fb936cc9b99e1ece4929013042316e1 100644 |
| --- a/chrome/browser/ui/browser_command_controller.cc |
| +++ b/chrome/browser/ui/browser_command_controller.cc |
| @@ -23,6 +23,7 @@ |
| #include "chrome/browser/ui/browser_tabstrip.h" |
| #include "chrome/browser/ui/browser_window.h" |
| #include "chrome/browser/ui/chrome_pages.h" |
| +#include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| @@ -43,6 +44,10 @@ |
| #include "base/win/metro.h" |
| #endif |
| +#if defined(USE_ASH) |
| +#include "ash/wm/window_util.h" |
| +#endif |
| + |
| using content::WebContents; |
| using content::NavigationEntry; |
| using content::NavigationController; |
| @@ -282,13 +287,27 @@ void BrowserCommandController::ExecuteCommandWithDisposition( |
| NewIncognitoWindow(browser_); |
| break; |
| case IDC_CLOSE_WINDOW: |
| - CloseWindow(browser_); |
| + // Destroying a tab / browser window while it has opened a full screen |
|
Ben Goodger (Google)
2012/08/10 15:00:12
Hrm. This works on Windows today (STR: open a new
|
| + // window will destroy it's content class - which will destroy the |
| + // delegate - which is also used by the opened full screen window's |
| + // event handler. That will cause then a crash. To avoid that we supress |
| + // closing of windows via key stroke while a full screen window is open. |
| + // http://crbug.com/134465, http://crbug.com/131436 |
| + if (!IsFullScreenWindowOpen()) |
| + CloseWindow(browser_); |
| break; |
| case IDC_NEW_TAB: |
| NewTab(browser_); |
| break; |
| case IDC_CLOSE_TAB: |
| - CloseTab(browser_); |
| + // Destroying a tab / browser window while it has opened a full screen |
| + // window will destroy it's content class - which will destroy the |
| + // delegate - which is also used by the opened full screen window's |
| + // event handler. That will cause then a crash. To avoid that we supress |
| + // closing of windows via key stroke while a full screen window is open. |
| + // http://crbug.com/134465, http://crbug.com/131436 |
| + if (!IsFullScreenWindowOpen()) |
| + CloseTab(browser_); |
| break; |
| case IDC_SELECT_NEXT_TAB: |
| SelectNextTab(browser_); |
| @@ -1078,4 +1097,13 @@ Profile* BrowserCommandController::profile() { |
| return browser_->profile(); |
| } |
| +bool BrowserCommandController::IsFullScreenWindowOpen() { |
| +#if defined(USE_ASH) |
| + aura::Window* window = ash::wm::GetActiveWindow(); |
| + return (window && ash::wm::IsWindowFullscreen(window)); |
| +#else |
| + return false; |
| +#endif |
| +} |
| + |
| } // namespace chrome |