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

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: Added unit tests, honored Cocoa memory management issues Created 5 years, 7 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..c467e048aace4b3717eadb6c4e35aea3102bd56f 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"
@@ -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,14 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
// Initialize the Profile menu.
[self initProfileMenu];
+
+ // Initialize the Share Menu. Limit execution of this method for OSX
+ // versions >= 10.9.
+#if defined(MAC_OS_X_VERSION_10_9) && \
+MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
+ [self initShareMenu];
+#endif
Avi (use Gerrit) 2015/05/15 16:13:08 No. You're doing a compile-time check, and you ne
+
}
- (void)unregisterEventHandlers {
@@ -603,8 +613,8 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
- (void)windowDidBecomeMain:(NSNotification*)notify {
Browser* browser = chrome::FindBrowserWithWindow([notify object]);
- if (browser)
- [self windowChangedToProfile:browser->profile()->GetOriginalProfile()];
+ if (browser)
+ [self windowChangedToProfile:browser->profile()->GetOriginalProfile()];
Avi (use Gerrit) 2015/05/15 16:13:08 Please don't make random formatting changes.
}
- (void)windowDidResignMain:(NSNotification*)notify {
@@ -1311,6 +1321,13 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
[[ProfileMenuController alloc] initWithMainMenuItem:profileMenu]);
}
+- (void)initShareMenu {
+ NSMenu* mainMenu = [NSApp mainMenu];
+
+ shareMenuController_.reset(
+ [[ShareMenuController alloc] initWithMainMenu:mainMenu]);
+}
+
// 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