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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 2950403002: [Mac] Add system share menu
Patch Set: CL comments Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/app_controller_mac.mm
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 8f55b28453e1ae9a30e928c078bda6926ba0b2d0..aa4a5ed294eddb3c94b8d045f2e295a5fc26032f 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -71,6 +71,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_controller.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
@@ -349,6 +350,9 @@ class AppControllerProfileObserver : public ProfileAttributesStorage::Observer {
// Initialize the Profile menu.
[self initProfileMenu];
+ // Initialize the share menu.
+ [self initShareMenu];
+
// If the OSX version supports this method, the system will automatically
// hide the item if there's no touch bar. However, for unsupported versions,
// we'll have to manually remove the item from the menu.
@@ -1222,6 +1226,15 @@ class AppControllerProfileObserver : public ProfileAttributesStorage::Observer {
[[ProfileMenuController alloc] initWithMainMenuItem:profileMenu]);
}
+- (void)initShareMenu {
+ shareMenuController_.reset([[ShareMenuController alloc] init]);
+ NSMenu* mainMenu = [NSApp mainMenu];
+ NSMenu* fileMenu = [[mainMenu itemWithTag:IDC_FILE_MENU] submenu];
+ NSMenuItem* shareMenuItem =
+ [fileMenu itemWithTitle:l10n_util::GetNSString(IDS_SHARE_MAC)];
Robert Sesek 2017/06/30 21:09:34 Maybe DCHECK(shareMenuItem) ?
+ [[shareMenuItem submenu] setDelegate:shareMenuController_.get()];
+}
+
// 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.

Powered by Google App Engine
This is Rietveld 408576698