OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 5 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
116 // For now, avoid breaking when initiating full screen tab mode while in | 116 // For now, avoid breaking when initiating full screen tab mode while in |
117 // a metro snap. | 117 // a metro snap. |
118 // TODO(robertshield): Find a way to reconcile tab-initiated fullscreen | 118 // TODO(robertshield): Find a way to reconcile tab-initiated fullscreen |
119 // modes with metro snap. | 119 // modes with metro snap. |
120 if (IsInMetroSnapMode()) | 120 if (IsInMetroSnapMode()) |
121 return; | 121 return; |
122 #endif | 122 #endif |
123 | 123 |
124 bool in_browser_or_tab_fullscreen_mode = window_->IsFullscreen(); | 124 bool in_browser_or_tab_fullscreen_mode = window_->IsFullscreen(); |
125 bool window_is_fullscreen_with_chrome = false; | |
126 #if defined(OS_MACOSX) | |
127 window_is_fullscreen_with_chrome = window_->IsFullscreenWithChrome(); | |
128 #endif | |
129 | 125 |
130 if (enter_fullscreen) { | 126 if (enter_fullscreen) { |
131 SetFullscreenedTab(web_contents); | 127 SetFullscreenedTab(web_contents); |
132 if (!in_browser_or_tab_fullscreen_mode) { | 128 if (!in_browser_or_tab_fullscreen_mode) { |
133 state_prior_to_tab_fullscreen_ = STATE_NORMAL; | 129 state_prior_to_tab_fullscreen_ = STATE_NORMAL; |
134 ToggleFullscreenModeInternal(TAB); | 130 ToggleFullscreenModeInternal(TAB); |
135 } else if (window_is_fullscreen_with_chrome) { | 131 } else { |
136 #if defined(OS_MACOSX) | 132 #if defined(OS_MACOSX) |
137 state_prior_to_tab_fullscreen_ = STATE_BROWSER_FULLSCREEN_WITH_CHROME; | 133 state_prior_to_tab_fullscreen_ = |
138 EnterFullscreenModeInternal(TAB); | 134 window_->IsFullscreenWithChrome() |
| 135 ? STATE_BROWSER_FULLSCREEN_WITH_CHROME |
| 136 : STATE_BROWSER_FULLSCREEN_NO_CHROME; |
| 137 |
| 138 // The browser is in AppKit fullscreen. Remove the chrome, if it's |
| 139 // present. |
| 140 window_->EnterFullscreenWithoutChrome(); |
139 #else | 141 #else |
140 NOTREACHED(); | |
141 #endif | |
142 } else { | |
143 state_prior_to_tab_fullscreen_ = STATE_BROWSER_FULLSCREEN_NO_CHROME; | 142 state_prior_to_tab_fullscreen_ = STATE_BROWSER_FULLSCREEN_NO_CHROME; |
| 143 #endif // defined(OS_MACOSX) |
144 | 144 |
145 // We need to update the fullscreen exit bubble, e.g., going from browser | 145 // We need to update the fullscreen exit bubble, e.g., going from browser |
146 // fullscreen to tab fullscreen will need to show different content. | 146 // fullscreen to tab fullscreen will need to show different content. |
147 const GURL& url = web_contents->GetURL(); | 147 const GURL& url = web_contents->GetURL(); |
148 if (!tab_fullscreen_accepted_) { | 148 if (!tab_fullscreen_accepted_) { |
149 tab_fullscreen_accepted_ = | 149 tab_fullscreen_accepted_ = |
150 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; | 150 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
151 } | 151 } |
152 UpdateFullscreenExitBubbleContent(); | 152 UpdateFullscreenExitBubbleContent(); |
153 | 153 |
154 // This is only a change between Browser and Tab fullscreen. We generate | 154 // This is only a change between Browser and Tab fullscreen. We generate |
155 // a fullscreen notification now because there is no window change. | 155 // a fullscreen notification now because there is no window change. |
156 PostFullscreenChangeNotification(true); | 156 PostFullscreenChangeNotification(true); |
157 } | 157 } |
158 } else { | 158 } else { |
159 if (in_browser_or_tab_fullscreen_mode) { | 159 if (in_browser_or_tab_fullscreen_mode) { |
160 if (IsFullscreenCausedByTab()) { | 160 if (IsFullscreenCausedByTab()) { |
161 ToggleFullscreenModeInternal(TAB); | 161 ToggleFullscreenModeInternal(TAB); |
162 } else { | 162 } else { |
163 #if defined(OS_MACOSX) | 163 #if defined(OS_MACOSX) |
164 if (state_prior_to_tab_fullscreen_ == | 164 if (state_prior_to_tab_fullscreen_ == |
165 STATE_BROWSER_FULLSCREEN_WITH_CHROME) { | 165 STATE_BROWSER_FULLSCREEN_WITH_CHROME) { |
166 EnterFullscreenModeInternal(BROWSER_WITH_CHROME); | 166 // The browser is still in AppKit Fullscreen. This just adds back the |
167 } else { | 167 // chrome. |
168 // Clear the bubble URL, which forces the Mac UI to redraw. | 168 window_->EnterFullscreenWithChrome(); |
169 UpdateFullscreenExitBubbleContent(); | |
170 } | 169 } |
171 #endif | 170 |
| 171 // Clear the bubble URL, which forces the Mac UI to redraw. |
| 172 UpdateFullscreenExitBubbleContent(); |
| 173 #endif // defined(OS_MACOSX) |
| 174 |
172 // If currently there is a tab in "tab fullscreen" mode and fullscreen | 175 // If currently there is a tab in "tab fullscreen" mode and fullscreen |
173 // was not caused by it (i.e., previously it was in "browser fullscreen" | 176 // was not caused by it (i.e., previously it was in "browser fullscreen" |
174 // mode), we need to switch back to "browser fullscreen" mode. In this | 177 // mode), we need to switch back to "browser fullscreen" mode. In this |
175 // case, all we have to do is notifying the tab that it has exited "tab | 178 // case, all we have to do is notifying the tab that it has exited "tab |
176 // fullscreen" mode. | 179 // fullscreen" mode. |
177 NotifyTabOfExitIfNecessary(); | 180 NotifyTabOfExitIfNecessary(); |
178 | 181 |
179 // This is only a change between Browser and Tab fullscreen. We generate | 182 // This is only a change between Browser and Tab fullscreen. We generate |
180 // a fullscreen notification now because there is no window change. | 183 // a fullscreen notification now because there is no window change. |
181 PostFullscreenChangeNotification(true); | 184 PostFullscreenChangeNotification(true); |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 (fullscreened_tab_ == mouse_lock_tab_ && IsPrivilegedFullscreenForTab()) ? | 758 (fullscreened_tab_ == mouse_lock_tab_ && IsPrivilegedFullscreenForTab()) ? |
756 mouse_lock_tab_->GetFullscreenRenderWidgetHostView() : NULL; | 759 mouse_lock_tab_->GetFullscreenRenderWidgetHostView() : NULL; |
757 if (!mouse_lock_view) { | 760 if (!mouse_lock_view) { |
758 RenderViewHost* const rvh = mouse_lock_tab_->GetRenderViewHost(); | 761 RenderViewHost* const rvh = mouse_lock_tab_->GetRenderViewHost(); |
759 if (rvh) | 762 if (rvh) |
760 mouse_lock_view = rvh->GetView(); | 763 mouse_lock_view = rvh->GetView(); |
761 } | 764 } |
762 if (mouse_lock_view) | 765 if (mouse_lock_view) |
763 mouse_lock_view->UnlockMouse(); | 766 mouse_lock_view->UnlockMouse(); |
764 } | 767 } |
OLD | NEW |