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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 161293002: mac: Allows extensions to hide the bookmark page menu item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make sure changes only apply to OSX. Created 6 years, 10 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/ui/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index f883a94e96d67cb53228d9d6c6bf5ba20cb9a1f3..f2d379ad08b4b320d418c64902ac6e291ef46025 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -28,6 +28,7 @@
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/bookmarks/bookmark_editor.h"
+#include "chrome/browser/ui/bookmarks/bookmark_utils.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_commands.h"
@@ -1122,6 +1123,17 @@ enum {
currentProfile:original_profile];
break;
}
+ case IDC_BOOKMARK_PAGE: {
+ // Extensions have the ability to hide the bookmark page menu item.
+ // This only affects the bookmark page menu item under the main menu.
+ // The bookmark page menu item under the wrench menu has its
+ // visibility controlled by WrenchMenuModel.
+ bool shouldHide =
+ !chrome::ShouldShowBookmarkPageMenuItem(browser_->profile());
+ NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item);
+ [menuItem setHidden:shouldHide];
+ break;
+ }
default:
// Special handling for the contents of the Text Encoding submenu. On
// Mac OS, instead of enabling/disabling the top-level menu item, we
@@ -1956,6 +1968,14 @@ willAnimateFromState:(BookmarkBar::State)oldState
[self updateAllowOverlappingViews:[self inPresentationMode]];
}
+- (void)activatePageAction:(const std::string&)extension_id {
+ [toolbarController_ activatePageAction:extension_id];
+}
+
+- (void)activateBrowserAction:(const std::string&)extension_id {
+ [toolbarController_ activateBrowserAction:extension_id];
+}
+
@end // @implementation BrowserWindowController
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | chrome/browser/ui/cocoa/extensions/browser_actions_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698