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

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

Issue 10879066: Revert 153205 - Temporarily revert 152729 - Revert "Fixing crash Crash Report - Stack Signature: co… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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"
27 #include "chrome/browser/ui/tab_contents/tab_contents.h" 26 #include "chrome/browser/ui/tab_contents/tab_contents.h"
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" 27 #include "chrome/browser/ui/tabs/tab_strip_model.h"
29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" 28 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
30 #include "chrome/common/chrome_notification_types.h" 29 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
32 #include "chrome/common/profiling.h" 31 #include "chrome/common/profiling.h"
33 #include "content/public/browser/native_web_keyboard_event.h" 32 #include "content/public/browser/native_web_keyboard_event.h"
34 #include "content/public/browser/navigation_controller.h" 33 #include "content/public/browser/navigation_controller.h"
35 #include "content/public/browser/navigation_entry.h" 34 #include "content/public/browser/navigation_entry.h"
36 #include "content/public/browser/notification_details.h" 35 #include "content/public/browser/notification_details.h"
37 #include "content/public/browser/notification_source.h" 36 #include "content/public/browser/notification_source.h"
38 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
39 #include "content/public/common/content_restriction.h" 38 #include "content/public/common/content_restriction.h"
40 #include "content/public/common/url_constants.h" 39 #include "content/public/common/url_constants.h"
41 #include "ui/base/keycodes/keyboard_codes.h" 40 #include "ui/base/keycodes/keyboard_codes.h"
42 41
43 #if defined(OS_WIN) 42 #if defined(OS_WIN)
44 #include "base/win/metro.h" 43 #include "base/win/metro.h"
45 #endif 44 #endif
46 45
47 #if defined(USE_ASH)
48 #include "ash/wm/window_util.h"
49 #endif
50
51 using content::WebContents; 46 using content::WebContents;
52 using content::NavigationEntry; 47 using content::NavigationEntry;
53 using content::NavigationController; 48 using content::NavigationController;
54 using content::WebContents; 49 using content::WebContents;
55 50
56 namespace { 51 namespace {
57 52
58 // Returns |true| if entry has an internal chrome:// URL, |false| otherwise. 53 // Returns |true| if entry has an internal chrome:// URL, |false| otherwise.
59 bool HasInternalURL(const NavigationEntry* entry) { 54 bool HasInternalURL(const NavigationEntry* entry) {
60 if (!entry) 55 if (!entry)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 break; 275 break;
281 276
282 // Window management commands 277 // Window management commands
283 case IDC_NEW_WINDOW: 278 case IDC_NEW_WINDOW:
284 NewWindow(browser_); 279 NewWindow(browser_);
285 break; 280 break;
286 case IDC_NEW_INCOGNITO_WINDOW: 281 case IDC_NEW_INCOGNITO_WINDOW:
287 NewIncognitoWindow(browser_); 282 NewIncognitoWindow(browser_);
288 break; 283 break;
289 case IDC_CLOSE_WINDOW: 284 case IDC_CLOSE_WINDOW:
290 // Destroying a tab / browser window while it has opened a full screen 285 CloseWindow(browser_);
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_);
300 break; 286 break;
301 case IDC_NEW_TAB: 287 case IDC_NEW_TAB:
302 NewTab(browser_); 288 NewTab(browser_);
303 break; 289 break;
304 case IDC_CLOSE_TAB: 290 case IDC_CLOSE_TAB:
305 // Destroying a tab / browser window while it has opened a full screen 291 CloseTab(browser_);
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_);
315 break; 292 break;
316 case IDC_SELECT_NEXT_TAB: 293 case IDC_SELECT_NEXT_TAB:
317 SelectNextTab(browser_); 294 SelectNextTab(browser_);
318 break; 295 break;
319 case IDC_SELECT_PREVIOUS_TAB: 296 case IDC_SELECT_PREVIOUS_TAB:
320 SelectPreviousTab(browser_); 297 SelectPreviousTab(browser_);
321 break; 298 break;
322 case IDC_TABPOSE: 299 case IDC_TABPOSE:
323 OpenTabpose(browser_); 300 OpenTabpose(browser_);
324 break; 301 break;
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1068 }
1092 1069
1093 BrowserWindow* BrowserCommandController::window() { 1070 BrowserWindow* BrowserCommandController::window() {
1094 return browser_->window(); 1071 return browser_->window();
1095 } 1072 }
1096 1073
1097 Profile* BrowserCommandController::profile() { 1074 Profile* BrowserCommandController::profile() {
1098 return browser_->profile(); 1075 return browser_->profile();
1099 } 1076 }
1100 1077
1101 bool BrowserCommandController::IsFullScreenWindowOpen() {
1102 #if defined(USE_ASH)
1103 aura::Window* window = ash::wm::GetActiveWindow();
1104 return (window && ash::wm::IsWindowFullscreen(window));
1105 #else
1106 return false;
1107 #endif
1108 }
1109
1110 } // namespace chrome 1078 } // 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