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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 1105143005: Issue 465302:System wide share options on Mac Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: System wide share menu for Mac Created 5 years, 8 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 91ae93205314708c7dc9ade72d85264fe460c0f9..8cda1ac73d8e996403e71703e76a405fa7fa108b 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/renderer_context_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"
@@ -207,10 +208,12 @@ bool IsProfileSignedOut(Profile* profile) {
} // namespace
-@interface AppController () <HandoffActiveURLObserverBridgeDelegate>
+@interface AppController () <HandoffActiveURLObserverBridgeDelegate,
+ NSSharingServiceDelegate>
- (void)initMenuState;
- (void)initProfileMenu;
+- (void)initShareMenu;
- (void)updateConfirmToQuitPrefMenuItem:(NSMenuItem*)item;
- (void)updateDisplayMessageCenterPrefMenuItem:(NSMenuItem*)item;
- (void)registerServicesMenuTypesTo:(NSApplication*)app;
@@ -223,6 +226,7 @@ bool IsProfileSignedOut(Profile* profile) {
- (void)executeApplication:(id)sender;
- (void)profileWasRemoved:(const base::FilePath&)profilePath;
+
Avi (use Gerrit) 2015/05/05 18:47:50 remove this extra line.
// Opens a tab for each GURL in |urls|.
- (void)openUrls:(const std::vector<GURL>&)urls;
@@ -388,6 +392,9 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
// Initialize the Profile menu.
[self initProfileMenu];
+
+ // Initialize the Share Menu
Avi (use Gerrit) 2015/05/05 18:47:50 period at the end; complete sentences, please.
+ [self initShareMenu];
}
- (void)unregisterEventHandlers {
@@ -603,8 +610,8 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
- (void)windowDidBecomeMain:(NSNotification*)notify {
Browser* browser = chrome::FindBrowserWithWindow([notify object]);
shrike 2015/05/05 18:20:22 Seems like this change is two lines being indented
- if (browser)
- [self windowChangedToProfile:browser->profile()->GetOriginalProfile()];
+ if (browser)
+ [self windowChangedToProfile:browser->profile()->GetOriginalProfile()];
}
- (void)windowDidResignMain:(NSNotification*)notify {
@@ -1311,6 +1318,13 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
[[ProfileMenuController alloc] initWithMainMenuItem:profileMenu]);
}
+- (void) initShareMenu {
Avi (use Gerrit) 2015/05/05 18:47:50 no space after )
+ NSMenu* mainMenu = [NSApp mainMenu];
+
+ shareMenuController_.reset(
+ [[ShareMenuController alloc] initWithMainMenu:mainMenu]);
Avi (use Gerrit) 2015/05/05 18:47:50 Why are you passing in the main menu? Why wouldn't
+}
+
// 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