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" |
11 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
12 #include "base/mac/mac_util.h" | 12 #include "base/mac/mac_util.h" |
13 #import "base/memory/scoped_nsobject.h" | 13 #import "base/memory/scoped_nsobject.h" |
14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/app/chrome_command_ids.h" // IDC_* | 16 #include "chrome/app/chrome_command_ids.h" // IDC_* |
17 #include "chrome/browser/bookmarks/bookmark_editor.h" | 17 #include "chrome/browser/bookmarks/bookmark_editor.h" |
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/instant/instant_controller.h" |
20 #include "chrome/browser/managed_mode/managed_mode.h" | 21 #include "chrome/browser/managed_mode/managed_mode.h" |
21 #include "chrome/browser/profiles/avatar_menu_model.h" | 22 #include "chrome/browser/profiles/avatar_menu_model.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_info_cache.h" | 24 #include "chrome/browser/profiles/profile_info_cache.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/signin/signin_ui_util.h" | 26 #include "chrome/browser/signin/signin_ui_util.h" |
26 #include "chrome/browser/themes/theme_service.h" | 27 #include "chrome/browser/themes/theme_service.h" |
27 #include "chrome/browser/themes/theme_service_factory.h" | 28 #include "chrome/browser/themes/theme_service_factory.h" |
28 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
29 #include "chrome/browser/ui/browser_command_controller.h" | 30 #include "chrome/browser/ui/browser_command_controller.h" |
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 } | 1952 } |
1952 | 1953 |
1953 - (void)updateBookmarkBarStateForInstantOverlay { | 1954 - (void)updateBookmarkBarStateForInstantOverlay { |
1954 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; | 1955 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; |
1955 [self updateContentOffsets]; | 1956 [self updateContentOffsets]; |
1956 [self updateSubviewZOrder:[self inPresentationMode]]; | 1957 [self updateSubviewZOrder:[self inPresentationMode]]; |
1957 } | 1958 } |
1958 | 1959 |
1959 @end // @implementation BrowserWindowController | 1960 @end // @implementation BrowserWindowController |
1960 | 1961 |
1961 | |
1962 @implementation BrowserWindowController(Fullscreen) | 1962 @implementation BrowserWindowController(Fullscreen) |
1963 | 1963 |
1964 - (void)handleLionToggleFullscreen { | 1964 - (void)handleLionToggleFullscreen { |
1965 DCHECK(base::mac::IsOSLionOrLater()); | 1965 DCHECK(base::mac::IsOSLionOrLater()); |
1966 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); | 1966 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); |
1967 } | 1967 } |
1968 | 1968 |
1969 // On Lion, this method is called by either the Lion fullscreen button or the | 1969 // On Lion, this method is called by either the Lion fullscreen button or the |
1970 // "Enter Full Screen" menu item. On Snow Leopard, this function is never | 1970 // "Enter Full Screen" menu item. On Snow Leopard, this function is never |
1971 // called by the UI directly, but it provides the implementation for | 1971 // called by the UI directly, but it provides the implementation for |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 // visible again. | 2174 // visible again. |
2175 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 2175 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
2176 [center addObserver:self | 2176 [center addObserver:self |
2177 selector:@selector(tabposeWillClose:) | 2177 selector:@selector(tabposeWillClose:) |
2178 name:NSWindowWillCloseNotification | 2178 name:NSWindowWillCloseNotification |
2179 object:window]; | 2179 object:window]; |
2180 } | 2180 } |
2181 | 2181 |
2182 @end // @implementation BrowserWindowController(Fullscreen) | 2182 @end // @implementation BrowserWindowController(Fullscreen) |
2183 | 2183 |
2184 | |
2185 @implementation BrowserWindowController(WindowType) | 2184 @implementation BrowserWindowController(WindowType) |
2186 | 2185 |
2187 - (BOOL)supportsWindowFeature:(int)feature { | 2186 - (BOOL)supportsWindowFeature:(int)feature { |
2188 return browser_->SupportsWindowFeature( | 2187 return browser_->SupportsWindowFeature( |
2189 static_cast<Browser::WindowFeature>(feature)); | 2188 static_cast<Browser::WindowFeature>(feature)); |
2190 } | 2189 } |
2191 | 2190 |
2192 - (BOOL)hasTitleBar { | 2191 - (BOOL)hasTitleBar { |
2193 return [self supportsWindowFeature:Browser::FEATURE_TITLEBAR]; | 2192 return [self supportsWindowFeature:Browser::FEATURE_TITLEBAR]; |
2194 } | 2193 } |
2195 | 2194 |
2196 - (BOOL)hasToolbar { | 2195 - (BOOL)hasToolbar { |
2197 return [self supportsWindowFeature:Browser::FEATURE_TOOLBAR]; | 2196 return [self supportsWindowFeature:Browser::FEATURE_TOOLBAR]; |
2198 } | 2197 } |
2199 | 2198 |
2200 - (BOOL)hasLocationBar { | 2199 - (BOOL)hasLocationBar { |
2201 return [self supportsWindowFeature:Browser::FEATURE_LOCATIONBAR]; | 2200 return [self supportsWindowFeature:Browser::FEATURE_LOCATIONBAR]; |
2202 } | 2201 } |
2203 | 2202 |
2204 - (BOOL)supportsBookmarkBar { | 2203 - (BOOL)supportsBookmarkBar { |
2205 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2204 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2206 } | 2205 } |
2207 | 2206 |
2208 - (BOOL)isTabbedWindow { | 2207 - (BOOL)isTabbedWindow { |
2209 return browser_->is_type_tabbed(); | 2208 return browser_->is_type_tabbed(); |
2210 } | 2209 } |
2211 | 2210 |
2212 @end // @implementation BrowserWindowController(WindowType) | 2211 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |