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

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 22867009: Swap main menu with app-specific menu when app window focused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't recreate the menu each time. Created 7 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
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 #import "chrome/browser/app_controller_mac.h" 5 #import "chrome/browser/app_controller_mac.h"
6 6
7 #include "apps/app_shim/extension_app_shim_handler_mac.h" 7 #include "apps/app_shim/extension_app_shim_handler_mac.h"
8 #include "apps/shell_window_registry.h" 8 #include "apps/shell_window_registry.h"
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/browser/sync/profile_sync_service.h" 46 #include "chrome/browser/sync/profile_sync_service.h"
47 #include "chrome/browser/sync/sync_ui_util.h" 47 #include "chrome/browser/sync/sync_ui_util.h"
48 #include "chrome/browser/ui/browser.h" 48 #include "chrome/browser/ui/browser.h"
49 #include "chrome/browser/ui/browser_command_controller.h" 49 #include "chrome/browser/ui/browser_command_controller.h"
50 #include "chrome/browser/ui/browser_commands.h" 50 #include "chrome/browser/ui/browser_commands.h"
51 #include "chrome/browser/ui/browser_finder.h" 51 #include "chrome/browser/ui/browser_finder.h"
52 #include "chrome/browser/ui/browser_iterator.h" 52 #include "chrome/browser/ui/browser_iterator.h"
53 #include "chrome/browser/ui/browser_mac.h" 53 #include "chrome/browser/ui/browser_mac.h"
54 #include "chrome/browser/ui/browser_window.h" 54 #include "chrome/browser/ui/browser_window.h"
55 #include "chrome/browser/ui/chrome_pages.h" 55 #include "chrome/browser/ui/chrome_pages.h"
56 #import "chrome/browser/ui/cocoa/apps/app_menu_controller_mac.h"
56 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" 57 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
57 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" 58 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
58 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 59 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
59 #import "chrome/browser/ui/cocoa/confirm_quit.h" 60 #import "chrome/browser/ui/cocoa/confirm_quit.h"
60 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" 61 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h"
61 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" 62 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h"
62 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" 63 #import "chrome/browser/ui/cocoa/history_menu_bridge.h"
63 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" 64 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
64 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" 65 #import "chrome/browser/ui/cocoa/profile_menu_controller.h"
65 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 66 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 selector:@selector(popoverDidClose:) 308 selector:@selector(popoverDidClose:)
308 name:NSPopoverDidCloseNotification 309 name:NSPopoverDidCloseNotification
309 object:nil]; 310 object:nil];
310 } 311 }
311 312
312 // Set up the command updater for when there are no windows open 313 // Set up the command updater for when there are no windows open
313 [self initMenuState]; 314 [self initMenuState];
314 315
315 // Initialize the Profile menu. 316 // Initialize the Profile menu.
316 [self initProfileMenu]; 317 [self initProfileMenu];
318
319 // Initialize the app menu controller.
320 appMenuController_.reset([[AppMenuController alloc] init]);
317 } 321 }
318 322
319 - (void)unregisterEventHandlers { 323 - (void)unregisterEventHandlers {
320 NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager]; 324 NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager];
321 [em removeEventHandlerForEventClass:kInternetEventClass 325 [em removeEventHandlerForEventClass:kInternetEventClass
322 andEventID:kAEGetURL]; 326 andEventID:kAEGetURL];
323 [em removeEventHandlerForEventClass:cloud_print::kAECloudPrintClass 327 [em removeEventHandlerForEventClass:cloud_print::kAECloudPrintClass
324 andEventID:cloud_print::kAECloudPrintClass]; 328 andEventID:cloud_print::kAECloudPrintClass];
325 [em removeEventHandlerForEventClass:'WWW!' 329 [em removeEventHandlerForEventClass:'WWW!'
326 andEventID:'OURL']; 330 andEventID:'OURL'];
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 1424
1421 //--------------------------------------------------------------------------- 1425 //---------------------------------------------------------------------------
1422 1426
1423 namespace app_controller_mac { 1427 namespace app_controller_mac {
1424 1428
1425 bool IsOpeningNewWindow() { 1429 bool IsOpeningNewWindow() {
1426 return g_is_opening_new_window; 1430 return g_is_opening_new_window;
1427 } 1431 }
1428 1432
1429 } // namespace app_controller_mac 1433 } // namespace app_controller_mac
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698