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

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

Issue 55683002: Instantiate AppShimMenuController when app launcher is enabled. (Mac) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Expose InitAppShimMenuController in AppController Created 7 years, 1 month 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/app_shim_mac.h" 7 #include "apps/app_shim/app_shim_mac.h"
8 #include "apps/app_shim/extension_app_shim_handler_mac.h" 8 #include "apps/app_shim/extension_app_shim_handler_mac.h"
9 #include "apps/shell_window_registry.h" 9 #include "apps/shell_window_registry.h"
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 // It is safe to access the default profile here. 674 // It is safe to access the default profile here.
675 - (void)applicationDidFinishLaunching:(NSNotification*)notify { 675 - (void)applicationDidFinishLaunching:(NSNotification*)notify {
676 // Notify BrowserList to keep the application running so it doesn't go away 676 // Notify BrowserList to keep the application running so it doesn't go away
677 // when all the browser windows get closed. 677 // when all the browser windows get closed.
678 chrome::StartKeepAlive(); 678 chrome::StartKeepAlive();
679 679
680 [self setUpdateCheckInterval]; 680 [self setUpdateCheckInterval];
681 681
682 // Start managing the menu for app windows. This needs to be done here because 682 // Start managing the menu for app windows. This needs to be done here because
683 // main menu item titles are not yet initialized in awakeFromNib. 683 // main menu item titles are not yet initialized in awakeFromNib.
684 if (apps::IsAppShimsEnabled()) 684 [self initAppShimMenuController];
Nico 2013/11/04 00:22:58 I meant "can you keep the `if (apps::IsAppShimsEna
685 appShimMenuController_.reset([[AppShimMenuController alloc] init]);
686 685
687 // Build up the encoding menu, the order of the items differs based on the 686 // Build up the encoding menu, the order of the items differs based on the
688 // current locale (see http://crbug.com/7647 for details). 687 // current locale (see http://crbug.com/7647 for details).
689 // We need a valid g_browser_process to get the profile which is why we can't 688 // We need a valid g_browser_process to get the profile which is why we can't
690 // call this from awakeFromNib. 689 // call this from awakeFromNib.
691 NSMenu* viewMenu = [[[NSApp mainMenu] itemWithTag:IDC_VIEW_MENU] submenu]; 690 NSMenu* viewMenu = [[[NSApp mainMenu] itemWithTag:IDC_VIEW_MENU] submenu];
692 NSMenuItem* encodingMenuItem = [viewMenu itemWithTag:IDC_ENCODING_MENU]; 691 NSMenuItem* encodingMenuItem = [viewMenu itemWithTag:IDC_ENCODING_MENU];
693 NSMenu* encodingMenu = [encodingMenuItem submenu]; 692 NSMenu* encodingMenu = [encodingMenuItem submenu];
694 EncodingMenuControllerDelegate::BuildEncodingMenu([self lastProfile], 693 EncodingMenuControllerDelegate::BuildEncodingMenu([self lastProfile],
695 encodingMenu); 694 encodingMenu);
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 } 1453 }
1455 1454
1456 - (void)addObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer { 1455 - (void)addObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer {
1457 workAreaChangeObservers_.AddObserver(observer); 1456 workAreaChangeObservers_.AddObserver(observer);
1458 } 1457 }
1459 1458
1460 - (void)removeObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer { 1459 - (void)removeObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer {
1461 workAreaChangeObservers_.RemoveObserver(observer); 1460 workAreaChangeObservers_.RemoveObserver(observer);
1462 } 1461 }
1463 1462
1463 - (void)initAppShimMenuController {
1464 if (apps::IsAppShimsEnabled() && !appShimMenuController_)
1465 appShimMenuController_.reset([[AppShimMenuController alloc] init]);
1466 }
1467
1464 - (void)applicationDidChangeScreenParameters:(NSNotification*)notification { 1468 - (void)applicationDidChangeScreenParameters:(NSNotification*)notification {
1465 // During this callback the working area is not always already updated. Defer. 1469 // During this callback the working area is not always already updated. Defer.
1466 [self performSelector:@selector(delayedScreenParametersUpdate) 1470 [self performSelector:@selector(delayedScreenParametersUpdate)
1467 withObject:nil 1471 withObject:nil
1468 afterDelay:0]; 1472 afterDelay:0];
1469 } 1473 }
1470 1474
1471 - (void)delayedScreenParametersUpdate { 1475 - (void)delayedScreenParametersUpdate {
1472 FOR_EACH_OBSERVER(ui::WorkAreaWatcherObserver, workAreaChangeObservers_, 1476 FOR_EACH_OBSERVER(ui::WorkAreaWatcherObserver, workAreaChangeObservers_,
1473 WorkAreaChanged()); 1477 WorkAreaChanged());
1474 } 1478 }
1475 1479
1476 @end // @implementation AppController 1480 @end // @implementation AppController
1477 1481
1478 //--------------------------------------------------------------------------- 1482 //---------------------------------------------------------------------------
1479 1483
1480 namespace app_controller_mac { 1484 namespace app_controller_mac {
1481 1485
1482 bool IsOpeningNewWindow() { 1486 bool IsOpeningNewWindow() {
1483 return g_is_opening_new_window; 1487 return g_is_opening_new_window;
1484 } 1488 }
1485 1489
1486 } // namespace app_controller_mac 1490 } // namespace app_controller_mac
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698