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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1949 - (void)onOverlappedViewShown { | 1961 - (void)onOverlappedViewShown { |
1950 ++overlappedViewCount_; | 1962 ++overlappedViewCount_; |
1951 [self updateAllowOverlappingViews:[self inPresentationMode]]; | 1963 [self updateAllowOverlappingViews:[self inPresentationMode]]; |
1952 } | 1964 } |
1953 | 1965 |
1954 - (void)onOverlappedViewHidden { | 1966 - (void)onOverlappedViewHidden { |
1955 --overlappedViewCount_; | 1967 --overlappedViewCount_; |
1956 [self updateAllowOverlappingViews:[self inPresentationMode]]; | 1968 [self updateAllowOverlappingViews:[self inPresentationMode]]; |
1957 } | 1969 } |
1958 | 1970 |
| 1971 - (void)activatePageAction:(const std::string&)extension_id { |
| 1972 [toolbarController_ activatePageAction:extension_id]; |
| 1973 } |
| 1974 |
| 1975 - (void)activateBrowserAction:(const std::string&)extension_id { |
| 1976 [toolbarController_ activateBrowserAction:extension_id]; |
| 1977 } |
| 1978 |
1959 @end // @implementation BrowserWindowController | 1979 @end // @implementation BrowserWindowController |
1960 | 1980 |
1961 | 1981 |
1962 @implementation BrowserWindowController(Fullscreen) | 1982 @implementation BrowserWindowController(Fullscreen) |
1963 | 1983 |
1964 - (void)handleLionToggleFullscreen { | 1984 - (void)handleLionToggleFullscreen { |
1965 DCHECK(base::mac::IsOSLionOrLater()); | 1985 DCHECK(base::mac::IsOSLionOrLater()); |
1966 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); | 1986 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); |
1967 } | 1987 } |
1968 | 1988 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 | 2204 |
2185 - (BOOL)supportsBookmarkBar { | 2205 - (BOOL)supportsBookmarkBar { |
2186 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2206 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2187 } | 2207 } |
2188 | 2208 |
2189 - (BOOL)isTabbedWindow { | 2209 - (BOOL)isTabbedWindow { |
2190 return browser_->is_type_tabbed(); | 2210 return browser_->is_type_tabbed(); |
2191 } | 2211 } |
2192 | 2212 |
2193 @end // @implementation BrowserWindowController(WindowType) | 2213 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |