| Index: chrome/browser/app_controller_mac.mm
|
| diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
|
| index 811185b1137ff73a329ac7884da9505f6ba7ae96..d3952c6a8448a113f3a0e2366f40fb5f750f07ac 100644
|
| --- a/chrome/browser/app_controller_mac.mm
|
| +++ b/chrome/browser/app_controller_mac.mm
|
| @@ -66,6 +66,7 @@
|
| #import "chrome/browser/ui/cocoa/history_menu_bridge.h"
|
| #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
|
| #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h"
|
| +#import "chrome/browser/ui/cocoa/share_menu/share_menu_controller.h"
|
| #include "chrome/browser/ui/extensions/application_launch.h"
|
| #include "chrome/browser/ui/host_desktop.h"
|
| #include "chrome/browser/ui/startup/startup_browser_creator.h"
|
| @@ -211,6 +212,7 @@ bool IsProfileSignedOut(Profile* profile) {
|
|
|
| - (void)initMenuState;
|
| - (void)initProfileMenu;
|
| +- (void)initShareMenu;
|
| - (void)updateConfirmToQuitPrefMenuItem:(NSMenuItem*)item;
|
| - (void)updateDisplayMessageCenterPrefMenuItem:(NSMenuItem*)item;
|
| - (void)registerServicesMenuTypesTo:(NSApplication*)app;
|
| @@ -388,6 +390,10 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
|
|
|
| // Initialize the Profile menu.
|
| [self initProfileMenu];
|
| +
|
| + // Initialize the Share menu. Call this method only for OSX versions >= 10.9.
|
| + if (base::mac::IsOSMavericksOrLater())
|
| + [self initShareMenu];
|
| }
|
|
|
| - (void)unregisterEventHandlers {
|
| @@ -750,6 +756,11 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
|
| EncodingMenuControllerDelegate::BuildEncodingMenu([self lastProfile],
|
| encodingMenu);
|
|
|
| + // Implement delegate methods to rebuild share menu when the cursor hovers
|
| + // over the Share Menu Item.
|
| + NSMenu* fileMenu = [[[NSApp mainMenu] itemWithTag:IDC_FILE_MENU] submenu];
|
| + [fileMenu setDelegate:self];
|
| +
|
| // Instantiate the ProfileInfoCache observer so that we can get
|
| // notified when a profile is deleted.
|
| profileInfoCacheObserver_.reset(new AppControllerProfileObserver(
|
| @@ -1303,6 +1314,23 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
|
| [[ProfileMenuController alloc] initWithMainMenuItem:profileMenu]);
|
| }
|
|
|
| +- (void)initShareMenu {
|
| + NSMenu* mainMenu = [NSApp mainMenu];
|
| +
|
| + shareMenuController_.reset(
|
| + [[ShareMenuController alloc] initWithMainMenu:mainMenu]);
|
| +}
|
| +
|
| +// Rebuild the share menu when the cursor hovers over Share Menu Item.
|
| +// This is to ensure Share menu has updated list of items since it has been
|
| +// changed in System Pref panel.
|
| +- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item {
|
| + if ([item tag] == IDC_SHARE_MENU) {
|
| + NSLog(@"menu item highlighted %@ %s", item, __FUNCTION__);
|
| + [shareMenuController_.get() rebuildShareMenu];
|
| + }
|
| +}
|
| +
|
| // The Confirm to Quit preference is atypical in that the preference lives in
|
| // the app menu right above the Quit menu item. This method will refresh the
|
| // display of that item depending on the preference state.
|
|
|