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