OLD | NEW |
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 Loading... |
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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 break; | 1116 break; |
1116 } | 1117 } |
1117 case IDC_SHOW_SIGNIN: { | 1118 case IDC_SHOW_SIGNIN: { |
1118 Profile* original_profile = | 1119 Profile* original_profile = |
1119 browser_->profile()->GetOriginalProfile(); | 1120 browser_->profile()->GetOriginalProfile(); |
1120 [BrowserWindowController updateSigninItem:item | 1121 [BrowserWindowController updateSigninItem:item |
1121 shouldShow:enable | 1122 shouldShow:enable |
1122 currentProfile:original_profile]; | 1123 currentProfile:original_profile]; |
1123 break; | 1124 break; |
1124 } | 1125 } |
| 1126 case IDC_BOOKMARK_PAGE: { |
| 1127 // Extensions have the ability to hide the bookmark page menu item. |
| 1128 // This only affects the bookmark page menu item under the main menu. |
| 1129 // The bookmark page menu item under the wrench menu has its |
| 1130 // visibility controlled by WrenchMenuModel. |
| 1131 bool shouldHide = |
| 1132 !chrome::ShouldShowBookmarkPageMenuItem(browser_->profile()); |
| 1133 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); |
| 1134 [menuItem setHidden:shouldHide]; |
| 1135 break; |
| 1136 } |
1125 default: | 1137 default: |
1126 // Special handling for the contents of the Text Encoding submenu. On | 1138 // Special handling for the contents of the Text Encoding submenu. On |
1127 // Mac OS, instead of enabling/disabling the top-level menu item, we | 1139 // Mac OS, instead of enabling/disabling the top-level menu item, we |
1128 // enable/disable the submenu's contents (per Apple's HIG). | 1140 // enable/disable the submenu's contents (per Apple's HIG). |
1129 EncodingMenuController encoding_controller; | 1141 EncodingMenuController encoding_controller; |
1130 if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) { | 1142 if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) { |
1131 enable &= chrome::IsCommandEnabled(browser_.get(), | 1143 enable &= chrome::IsCommandEnabled(browser_.get(), |
1132 IDC_ENCODING_MENU) ? YES : NO; | 1144 IDC_ENCODING_MENU) ? YES : NO; |
1133 } | 1145 } |
1134 } | 1146 } |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 | 2196 |
2185 - (BOOL)supportsBookmarkBar { | 2197 - (BOOL)supportsBookmarkBar { |
2186 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2198 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2187 } | 2199 } |
2188 | 2200 |
2189 - (BOOL)isTabbedWindow { | 2201 - (BOOL)isTabbedWindow { |
2190 return browser_->is_type_tabbed(); | 2202 return browser_->is_type_tabbed(); |
2191 } | 2203 } |
2192 | 2204 |
2193 @end // @implementation BrowserWindowController(WindowType) | 2205 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |