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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 18576005: [Mac] Adds a flag to force 10.6-style fullscreen for testing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove broken DCHECK. Created 7 years, 5 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"
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 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/app/chrome_command_ids.h" // IDC_* 15 #include "chrome/app/chrome_command_ids.h" // IDC_*
16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/devtools/devtools_window.h" 18 #include "chrome/browser/devtools/devtools_window.h"
19 #include "chrome/browser/fullscreen.h"
19 #include "chrome/browser/profiles/avatar_menu_model.h" 20 #include "chrome/browser/profiles/avatar_menu_model.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_info_cache.h" 22 #include "chrome/browser/profiles/profile_info_cache.h"
22 #include "chrome/browser/profiles/profile_manager.h" 23 #include "chrome/browser/profiles/profile_manager.h"
23 #include "chrome/browser/signin/signin_ui_util.h" 24 #include "chrome/browser/signin/signin_ui_util.h"
24 #include "chrome/browser/themes/theme_service.h" 25 #include "chrome/browser/themes/theme_service.h"
25 #include "chrome/browser/themes/theme_service_factory.h" 26 #include "chrome/browser/themes/theme_service_factory.h"
26 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" 27 #include "chrome/browser/ui/bookmarks/bookmark_editor.h"
27 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
28 #include "chrome/browser/ui/browser_command_controller.h" 29 #include "chrome/browser/ui/browser_command_controller.h"
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 enable &= !![[static_cast<NSMenuItem*>(item) keyEquivalent] length]; 1112 enable &= !![[static_cast<NSMenuItem*>(item) keyEquivalent] length];
1112 break; 1113 break;
1113 case IDC_FULLSCREEN: { 1114 case IDC_FULLSCREEN: {
1114 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) { 1115 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) {
1115 NSString* menuTitle = l10n_util::GetNSString( 1116 NSString* menuTitle = l10n_util::GetNSString(
1116 [self isFullscreen] && ![self inPresentationMode] ? 1117 [self isFullscreen] && ![self inPresentationMode] ?
1117 IDS_EXIT_FULLSCREEN_MAC : 1118 IDS_EXIT_FULLSCREEN_MAC :
1118 IDS_ENTER_FULLSCREEN_MAC); 1119 IDS_ENTER_FULLSCREEN_MAC);
1119 [static_cast<NSMenuItem*>(item) setTitle:menuTitle]; 1120 [static_cast<NSMenuItem*>(item) setTitle:menuTitle];
1120 1121
1121 if (base::mac::IsOSSnowLeopard()) 1122 if (!chrome::mac::SupportsSystemFullscreen())
1122 [static_cast<NSMenuItem*>(item) setHidden:YES]; 1123 [static_cast<NSMenuItem*>(item) setHidden:YES];
1123 } 1124 }
1124 break; 1125 break;
1125 } 1126 }
1126 case IDC_PRESENTATION_MODE: { 1127 case IDC_PRESENTATION_MODE: {
1127 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) { 1128 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) {
1128 NSString* menuTitle = l10n_util::GetNSString( 1129 NSString* menuTitle = l10n_util::GetNSString(
1129 [self inPresentationMode] ? IDS_EXIT_PRESENTATION_MAC : 1130 [self inPresentationMode] ? IDS_EXIT_PRESENTATION_MAC :
1130 IDS_ENTER_PRESENTATION_MAC); 1131 IDS_ENTER_PRESENTATION_MAC);
1131 [static_cast<NSMenuItem*>(item) setTitle:menuTitle]; 1132 [static_cast<NSMenuItem*>(item) setTitle:menuTitle];
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 // "Enter Full Screen" menu item. On Snow Leopard, this function is never 2022 // "Enter Full Screen" menu item. On Snow Leopard, this function is never
2022 // called by the UI directly, but it provides the implementation for 2023 // called by the UI directly, but it provides the implementation for
2023 // |-setPresentationMode:|. 2024 // |-setPresentationMode:|.
2024 - (void)setFullscreen:(BOOL)fullscreen { 2025 - (void)setFullscreen:(BOOL)fullscreen {
2025 if (fullscreen == [self isFullscreen]) 2026 if (fullscreen == [self isFullscreen])
2026 return; 2027 return;
2027 2028
2028 if (!chrome::IsCommandEnabled(browser_.get(), IDC_FULLSCREEN)) 2029 if (!chrome::IsCommandEnabled(browser_.get(), IDC_FULLSCREEN))
2029 return; 2030 return;
2030 2031
2031 if (base::mac::IsOSLionOrLater()) { 2032 if (chrome::mac::SupportsSystemFullscreen()) {
2032 enteredPresentationModeFromFullscreen_ = YES; 2033 enteredPresentationModeFromFullscreen_ = YES;
2033 if ([[self window] isKindOfClass:[FramedBrowserWindow class]]) 2034 if ([[self window] isKindOfClass:[FramedBrowserWindow class]])
2034 [static_cast<FramedBrowserWindow*>([self window]) toggleSystemFullScreen]; 2035 [static_cast<FramedBrowserWindow*>([self window]) toggleSystemFullScreen];
2035 } else { 2036 } else {
2036 if (fullscreen) 2037 if (fullscreen)
2037 [self enterFullscreenForSnowLeopard]; 2038 [self enterFullscreenForSnowLeopard];
2038 else 2039 else
2039 [self exitFullscreenForSnowLeopard]; 2040 [self exitFullscreenForSnowLeopard];
2040 } 2041 }
2041 } 2042 }
(...skipping 24 matching lines...) Expand all
2066 // function also triggers the Lion machinery to enter fullscreen mode as well as 2067 // function also triggers the Lion machinery to enter fullscreen mode as well as
2067 // set presentation mode. On Snow Leopard, this function is called by the 2068 // set presentation mode. On Snow Leopard, this function is called by the
2068 // "Enter Presentation Mode" menu item, and triggering presentation mode always 2069 // "Enter Presentation Mode" menu item, and triggering presentation mode always
2069 // moves the user into fullscreen mode. 2070 // moves the user into fullscreen mode.
2070 - (void)setPresentationMode:(BOOL)presentationMode 2071 - (void)setPresentationMode:(BOOL)presentationMode
2071 url:(const GURL&)url 2072 url:(const GURL&)url
2072 bubbleType:(FullscreenExitBubbleType)bubbleType { 2073 bubbleType:(FullscreenExitBubbleType)bubbleType {
2073 fullscreenUrl_ = url; 2074 fullscreenUrl_ = url;
2074 fullscreenBubbleType_ = bubbleType; 2075 fullscreenBubbleType_ = bubbleType;
2075 2076
2076 // Presentation mode on Snow Leopard maps directly to fullscreen mode. 2077 // Presentation mode on systems without fullscreen support maps directly to
2077 if (base::mac::IsOSSnowLeopard()) { 2078 // fullscreen mode.
2079 if (!chrome::mac::SupportsSystemFullscreen()) {
2078 [self setFullscreen:presentationMode]; 2080 [self setFullscreen:presentationMode];
2079 return; 2081 return;
2080 } 2082 }
2081 2083
2082 if (presentationMode) { 2084 if (presentationMode) {
2083 BOOL fullscreen = [self isFullscreen]; 2085 BOOL fullscreen = [self isFullscreen];
2084 enteredPresentationModeFromFullscreen_ = fullscreen; 2086 enteredPresentationModeFromFullscreen_ = fullscreen;
2085 enteringPresentationMode_ = YES; 2087 enteringPresentationMode_ = YES;
2086 2088
2087 if (fullscreen) { 2089 if (fullscreen) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 2263
2262 - (BOOL)supportsBookmarkBar { 2264 - (BOOL)supportsBookmarkBar {
2263 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2265 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2264 } 2266 }
2265 2267
2266 - (BOOL)isTabbedWindow { 2268 - (BOOL)isTabbedWindow {
2267 return browser_->is_type_tabbed(); 2269 return browser_->is_type_tabbed();
2268 } 2270 }
2269 2271
2270 @end // @implementation BrowserWindowController(WindowType) 2272 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698