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

Side by Side 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: Rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/fullscreen.h" 21 #include "chrome/browser/fullscreen.h"
22 #include "chrome/browser/profiles/avatar_menu.h" 22 #include "chrome/browser/profiles/avatar_menu.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/profiles/profile_info_cache.h" 24 #include "chrome/browser/profiles/profile_info_cache.h"
25 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
26 #include "chrome/browser/profiles/profiles_state.h" 26 #include "chrome/browser/profiles/profiles_state.h"
27 #include "chrome/browser/signin/signin_ui_util.h" 27 #include "chrome/browser/signin/signin_ui_util.h"
28 #include "chrome/browser/themes/theme_service.h" 28 #include "chrome/browser/themes/theme_service.h"
29 #include "chrome/browser/themes/theme_service_factory.h" 29 #include "chrome/browser/themes/theme_service_factory.h"
30 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" 30 #include "chrome/browser/ui/bookmarks/bookmark_editor.h"
31 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
31 #include "chrome/browser/ui/browser.h" 32 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_command_controller.h" 33 #include "chrome/browser/ui/browser_command_controller.h"
33 #include "chrome/browser/ui/browser_commands.h" 34 #include "chrome/browser/ui/browser_commands.h"
34 #include "chrome/browser/ui/browser_instant_controller.h" 35 #include "chrome/browser/ui/browser_instant_controller.h"
35 #include "chrome/browser/ui/browser_list.h" 36 #include "chrome/browser/ui/browser_list.h"
36 #include "chrome/browser/ui/browser_window_state.h" 37 #include "chrome/browser/ui/browser_window_state.h"
37 #import "chrome/browser/ui/cocoa/background_gradient_view.h" 38 #import "chrome/browser/ui/cocoa/background_gradient_view.h"
38 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 39 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
39 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" 40 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h"
40 #import "chrome/browser/ui/cocoa/browser/avatar_base_controller.h" 41 #import "chrome/browser/ui/cocoa/browser/avatar_base_controller.h"
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 break; 1121 break;
1121 } 1122 }
1122 case IDC_SHOW_SIGNIN: { 1123 case IDC_SHOW_SIGNIN: {
1123 Profile* original_profile = 1124 Profile* original_profile =
1124 browser_->profile()->GetOriginalProfile(); 1125 browser_->profile()->GetOriginalProfile();
1125 [BrowserWindowController updateSigninItem:item 1126 [BrowserWindowController updateSigninItem:item
1126 shouldShow:enable 1127 shouldShow:enable
1127 currentProfile:original_profile]; 1128 currentProfile:original_profile];
1128 break; 1129 break;
1129 } 1130 }
1131 case IDC_BOOKMARK_PAGE: {
1132 // Extensions have the ability to hide the bookmark page menu item.
1133 // This only affects the bookmark page menu item under the main menu.
1134 // The bookmark page menu item under the wrench menu has its
1135 // visibility controlled by WrenchMenuModel.
1136 bool shouldHide =
1137 !chrome::ShouldShowBookmarkPageMenuItem(browser_->profile());
1138 NSMenuItem* menuItem = static_cast<NSMenuItem*>(item);
Robert Sesek 2014/02/24 14:06:07 Use base::mac::ObjCCast
erikchen 2014/02/26 01:08:19 Done.
1139 menuItem.hidden = shouldHide;
Robert Sesek 2014/02/24 14:06:07 There's a strong preference in this file for calli
erikchen 2014/02/26 01:08:19 Done.
1140 break;
1141 }
1130 default: 1142 default:
1131 // Special handling for the contents of the Text Encoding submenu. On 1143 // Special handling for the contents of the Text Encoding submenu. On
1132 // Mac OS, instead of enabling/disabling the top-level menu item, we 1144 // Mac OS, instead of enabling/disabling the top-level menu item, we
1133 // enable/disable the submenu's contents (per Apple's HIG). 1145 // enable/disable the submenu's contents (per Apple's HIG).
1134 EncodingMenuController encoding_controller; 1146 EncodingMenuController encoding_controller;
1135 if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) { 1147 if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) {
1136 enable &= chrome::IsCommandEnabled(browser_.get(), 1148 enable &= chrome::IsCommandEnabled(browser_.get(),
1137 IDC_ENCODING_MENU) ? YES : NO; 1149 IDC_ENCODING_MENU) ? YES : NO;
1138 } 1150 }
1139 } 1151 }
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 2244
2233 - (BOOL)supportsBookmarkBar { 2245 - (BOOL)supportsBookmarkBar {
2234 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2246 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2235 } 2247 }
2236 2248
2237 - (BOOL)isTabbedWindow { 2249 - (BOOL)isTabbedWindow {
2238 return browser_->is_type_tabbed(); 2250 return browser_->is_type_tabbed();
2239 } 2251 }
2240 2252
2241 @end // @implementation BrowserWindowController(WindowType) 2253 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698