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

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

Issue 10836186: Fixing crash Crash Report - Stack Signature: content::RenderWidgetHostImpl::ForwardKeybo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing crasher upon closing tab on Ctrl+W Created 8 years, 4 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 | « chrome/browser/ui/browser_command_controller.h ('k') | no next file » | 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/browser_command_controller.h" 5 #include "chrome/browser/ui/browser_command_controller.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/defaults.h" 9 #include "chrome/browser/defaults.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/prefs/incognito_mode_prefs.h" 11 #include "chrome/browser/prefs/incognito_mode_prefs.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/printing/print_preview_tab_controller.h" 13 #include "chrome/browser/printing/print_preview_tab_controller.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/sessions/tab_restore_service.h" 16 #include "chrome/browser/sessions/tab_restore_service.h"
17 #include "chrome/browser/sessions/tab_restore_service_factory.h" 17 #include "chrome/browser/sessions/tab_restore_service_factory.h"
18 #include "chrome/browser/sync/profile_sync_service.h" 18 #include "chrome/browser/sync/profile_sync_service.h"
19 #include "chrome/browser/sync/profile_sync_service_factory.h" 19 #include "chrome/browser/sync/profile_sync_service_factory.h"
20 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 20 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_commands.h" 22 #include "chrome/browser/ui/browser_commands.h"
23 #include "chrome/browser/ui/browser_tabstrip.h" 23 #include "chrome/browser/ui/browser_tabstrip.h"
24 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/chrome_pages.h" 25 #include "chrome/browser/ui/chrome_pages.h"
26 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
26 #include "chrome/browser/ui/tab_contents/tab_contents.h" 27 #include "chrome/browser/ui/tab_contents/tab_contents.h"
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" 28 #include "chrome/browser/ui/tabs/tab_strip_model.h"
28 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" 29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
29 #include "chrome/common/chrome_notification_types.h" 30 #include "chrome/common/chrome_notification_types.h"
30 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
31 #include "chrome/common/profiling.h" 32 #include "chrome/common/profiling.h"
32 #include "content/public/browser/native_web_keyboard_event.h" 33 #include "content/public/browser/native_web_keyboard_event.h"
33 #include "content/public/browser/navigation_controller.h" 34 #include "content/public/browser/navigation_controller.h"
34 #include "content/public/browser/navigation_entry.h" 35 #include "content/public/browser/navigation_entry.h"
35 #include "content/public/browser/notification_details.h" 36 #include "content/public/browser/notification_details.h"
36 #include "content/public/browser/notification_source.h" 37 #include "content/public/browser/notification_source.h"
37 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
38 #include "content/public/common/content_restriction.h" 39 #include "content/public/common/content_restriction.h"
39 #include "content/public/common/url_constants.h" 40 #include "content/public/common/url_constants.h"
40 #include "ui/base/keycodes/keyboard_codes.h" 41 #include "ui/base/keycodes/keyboard_codes.h"
41 42
42 #if defined(OS_WIN) 43 #if defined(OS_WIN)
43 #include "base/win/metro.h" 44 #include "base/win/metro.h"
44 #endif 45 #endif
45 46
47 #if defined(USE_ASH)
48 #include "ash/wm/window_util.h"
49 #endif
50
46 using content::WebContents; 51 using content::WebContents;
47 using content::NavigationEntry; 52 using content::NavigationEntry;
48 using content::NavigationController; 53 using content::NavigationController;
49 using content::WebContents; 54 using content::WebContents;
50 55
51 namespace { 56 namespace {
52 57
53 // Returns |true| if entry has an internal chrome:// URL, |false| otherwise. 58 // Returns |true| if entry has an internal chrome:// URL, |false| otherwise.
54 bool HasInternalURL(const NavigationEntry* entry) { 59 bool HasInternalURL(const NavigationEntry* entry) {
55 if (!entry) 60 if (!entry)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 break; 280 break;
276 281
277 // Window management commands 282 // Window management commands
278 case IDC_NEW_WINDOW: 283 case IDC_NEW_WINDOW:
279 NewWindow(browser_); 284 NewWindow(browser_);
280 break; 285 break;
281 case IDC_NEW_INCOGNITO_WINDOW: 286 case IDC_NEW_INCOGNITO_WINDOW:
282 NewIncognitoWindow(browser_); 287 NewIncognitoWindow(browser_);
283 break; 288 break;
284 case IDC_CLOSE_WINDOW: 289 case IDC_CLOSE_WINDOW:
285 CloseWindow(browser_); 290 // Destroying a tab / browser window while it has opened a full screen
291 // window will destroy it's content class - which will destroy the
292 // delegate - which is also used by the opened full screen window's
293 // event handler. That will cause then a crash. To avoid that we supress
294 // closing of windows via key stroke while a full screen window is open.
295 // http://crbug.com/134465, http://crbug.com/131436
296 #if defined(OS_CHROMEOS)
297 if (!IsFullScreenWindowOpen())
298 #endif
299 CloseWindow(browser_);
286 break; 300 break;
287 case IDC_NEW_TAB: 301 case IDC_NEW_TAB:
288 NewTab(browser_); 302 NewTab(browser_);
289 break; 303 break;
290 case IDC_CLOSE_TAB: 304 case IDC_CLOSE_TAB:
291 CloseTab(browser_); 305 // Destroying a tab / browser window while it has opened a full screen
306 // window will destroy it's content class - which will destroy the
307 // delegate - which is also used by the opened full screen window's
308 // event handler. That will cause then a crash. To avoid that we supress
309 // closing of windows via key stroke while a full screen window is open.
310 // http://crbug.com/134465, http://crbug.com/131436
311 #if defined(OS_CHROMEOS)
312 if (!IsFullScreenWindowOpen())
313 #endif
314 CloseTab(browser_);
292 break; 315 break;
293 case IDC_SELECT_NEXT_TAB: 316 case IDC_SELECT_NEXT_TAB:
294 SelectNextTab(browser_); 317 SelectNextTab(browser_);
295 break; 318 break;
296 case IDC_SELECT_PREVIOUS_TAB: 319 case IDC_SELECT_PREVIOUS_TAB:
297 SelectPreviousTab(browser_); 320 SelectPreviousTab(browser_);
298 break; 321 break;
299 case IDC_TABPOSE: 322 case IDC_TABPOSE:
300 OpenTabpose(browser_); 323 OpenTabpose(browser_);
301 break; 324 break;
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 } 1094 }
1072 1095
1073 BrowserWindow* BrowserCommandController::window() { 1096 BrowserWindow* BrowserCommandController::window() {
1074 return browser_->window(); 1097 return browser_->window();
1075 } 1098 }
1076 1099
1077 Profile* BrowserCommandController::profile() { 1100 Profile* BrowserCommandController::profile() {
1078 return browser_->profile(); 1101 return browser_->profile();
1079 } 1102 }
1080 1103
1104 bool BrowserCommandController::IsFullScreenWindowOpen() {
1105 #if defined(USE_ASH)
1106 aura::Window* window = ash::wm::GetActiveWindow();
1107 return (window && ash::wm::IsWindowFullscreen(window));
1108 #else
1109 return false;
1110 #endif
1111 }
1112
1081 } // namespace chrome 1113 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_command_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698