| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 #include "content/public/browser/render_view_host.h" | 94 #include "content/public/browser/render_view_host.h" |
| 95 #include "content/public/browser/render_widget_host.h" | 95 #include "content/public/browser/render_widget_host.h" |
| 96 #include "content/public/browser/render_widget_host_view.h" | 96 #include "content/public/browser/render_widget_host_view.h" |
| 97 #include "content/public/browser/web_contents.h" | 97 #include "content/public/browser/web_contents.h" |
| 98 #import "ui/base/cocoa/cocoa_base_utils.h" | 98 #import "ui/base/cocoa/cocoa_base_utils.h" |
| 99 #import "ui/base/cocoa/nsview_additions.h" | 99 #import "ui/base/cocoa/nsview_additions.h" |
| 100 #include "ui/base/l10n/l10n_util.h" | 100 #include "ui/base/l10n/l10n_util.h" |
| 101 #include "ui/base/l10n/l10n_util_mac.h" | 101 #include "ui/base/l10n/l10n_util_mac.h" |
| 102 #import "ui/gfx/mac/coordinate_conversion.h" | 102 #import "ui/gfx/mac/coordinate_conversion.h" |
| 103 #include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h" | 103 #include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h" |
| 104 #include "ui/gfx/screen.h" |
| 104 | 105 |
| 105 using bookmarks::BookmarkModel; | 106 using bookmarks::BookmarkModel; |
| 106 using bookmarks::BookmarkNode; | 107 using bookmarks::BookmarkNode; |
| 107 using l10n_util::GetStringUTF16; | 108 using l10n_util::GetStringUTF16; |
| 108 using l10n_util::GetNSStringWithFixup; | 109 using l10n_util::GetNSStringWithFixup; |
| 109 using l10n_util::GetNSStringFWithFixup; | 110 using l10n_util::GetNSStringFWithFixup; |
| 110 | 111 |
| 111 // ORGANIZATION: This is a big file. It is (in principle) organized as follows | 112 // ORGANIZATION: This is a big file. It is (in principle) organized as follows |
| 112 // (in order): | 113 // (in order): |
| 113 // 1. Interfaces. Very short, one-time-use classes may include an implementation | 114 // 1. Interfaces. Very short, one-time-use classes may include an implementation |
| (...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 [self enterBrowserFullscreenWithToolbar:NO]; | 2011 [self enterBrowserFullscreenWithToolbar:NO]; |
| 2011 } else { | 2012 } else { |
| 2012 [self enterImmersiveFullscreen]; | 2013 [self enterImmersiveFullscreen]; |
| 2013 DCHECK(!exclusiveAccessController_->url().is_empty()); | 2014 DCHECK(!exclusiveAccessController_->url().is_empty()); |
| 2014 [self updateFullscreenExitBubble]; | 2015 [self updateFullscreenExitBubble]; |
| 2015 } | 2016 } |
| 2016 } | 2017 } |
| 2017 | 2018 |
| 2018 - (void)enterWebContentFullscreen { | 2019 - (void)enterWebContentFullscreen { |
| 2019 // HTML5 Fullscreen should only use AppKit fullscreen in 10.10+. | 2020 // HTML5 Fullscreen should only use AppKit fullscreen in 10.10+. |
| 2021 // However, if the user is using multiple monitors and turned off |
| 2022 // "Separate Space in Each Display", use Immersive Fullscreen so |
| 2023 // that the other monitors won't blank out. |
| 2024 gfx::Screen* screen = gfx::Screen::GetScreen(); |
| 2025 BOOL hasMultipleMonitors = screen && screen->GetNumDisplays() > 1; |
| 2020 if (chrome::mac::SupportsSystemFullscreen() && | 2026 if (chrome::mac::SupportsSystemFullscreen() && |
| 2021 base::mac::IsOSYosemiteOrLater()) | 2027 base::mac::IsOSYosemiteOrLater() && |
| 2028 !(hasMultipleMonitors && ![NSScreen screensHaveSeparateSpaces])) { |
| 2022 [self enterAppKitFullscreen]; | 2029 [self enterAppKitFullscreen]; |
| 2023 else | 2030 } else { |
| 2024 [self enterImmersiveFullscreen]; | 2031 [self enterImmersiveFullscreen]; |
| 2032 } |
| 2025 | 2033 |
| 2026 if (!exclusiveAccessController_->url().is_empty()) | 2034 if (!exclusiveAccessController_->url().is_empty()) |
| 2027 [self updateFullscreenExitBubble]; | 2035 [self updateFullscreenExitBubble]; |
| 2028 } | 2036 } |
| 2029 | 2037 |
| 2030 - (void)exitAnyFullscreen { | 2038 - (void)exitAnyFullscreen { |
| 2031 // TODO(erikchen): Fullscreen modes should stack. Should be able to exit | 2039 // TODO(erikchen): Fullscreen modes should stack. Should be able to exit |
| 2032 // Immersive Fullscreen and still be in AppKit Fullscreen. | 2040 // Immersive Fullscreen and still be in AppKit Fullscreen. |
| 2033 if ([self isInAppKitFullscreen]) | 2041 if ([self isInAppKitFullscreen]) |
| 2034 [self exitAppKitFullscreen]; | 2042 [self exitAppKitFullscreen]; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 | 2133 |
| 2126 - (BOOL)supportsBookmarkBar { | 2134 - (BOOL)supportsBookmarkBar { |
| 2127 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2135 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2128 } | 2136 } |
| 2129 | 2137 |
| 2130 - (BOOL)isTabbedWindow { | 2138 - (BOOL)isTabbedWindow { |
| 2131 return browser_->is_type_tabbed(); | 2139 return browser_->is_type_tabbed(); |
| 2132 } | 2140 } |
| 2133 | 2141 |
| 2134 @end // @implementation BrowserWindowController(WindowType) | 2142 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |