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/exclusive_access/fullscreen_controller.h" | 5 #include "chrome/browser/ui/exclusive_access/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/location.h" | 9 #include "base/location.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 231 } |
232 | 232 |
233 void FullscreenController::OnTabClosing(WebContents* web_contents) { | 233 void FullscreenController::OnTabClosing(WebContents* web_contents) { |
234 if (IsFullscreenForCapturedTab(web_contents)) | 234 if (IsFullscreenForCapturedTab(web_contents)) |
235 web_contents->ExitFullscreen( | 235 web_contents->ExitFullscreen( |
236 /* will_cause_resize */ IsFullscreenCausedByTab()); | 236 /* will_cause_resize */ IsFullscreenCausedByTab()); |
237 else | 237 else |
238 ExclusiveAccessControllerBase::OnTabClosing(web_contents); | 238 ExclusiveAccessControllerBase::OnTabClosing(web_contents); |
239 } | 239 } |
240 | 240 |
| 241 void FullscreenController::WindowFullscreenStateWillChange() { |
| 242 ExclusiveAccessContext* exclusive_access_context = |
| 243 exclusive_access_manager()->context(); |
| 244 if (exclusive_access_context->IsFullscreen()) { |
| 245 exclusive_access_context->HideDownloadShelf(); |
| 246 } else { |
| 247 exclusive_access_context->UnhideDownloadShelf(); |
| 248 } |
| 249 } |
| 250 |
241 void FullscreenController::WindowFullscreenStateChanged() { | 251 void FullscreenController::WindowFullscreenStateChanged() { |
242 reentrant_window_state_change_call_check_ = true; | 252 reentrant_window_state_change_call_check_ = true; |
243 ExclusiveAccessContext* const exclusive_access_context = | 253 ExclusiveAccessContext* const exclusive_access_context = |
244 exclusive_access_manager()->context(); | 254 exclusive_access_manager()->context(); |
245 bool exiting_fullscreen = !exclusive_access_context->IsFullscreen(); | 255 bool exiting_fullscreen = !exclusive_access_context->IsFullscreen(); |
246 | 256 |
247 PostFullscreenChangeNotification(!exiting_fullscreen); | 257 PostFullscreenChangeNotification(!exiting_fullscreen); |
248 if (exiting_fullscreen) { | 258 if (exiting_fullscreen) { |
249 toggled_into_fullscreen_ = false; | 259 toggled_into_fullscreen_ = false; |
250 extension_caused_fullscreen_ = GURL(); | 260 extension_caused_fullscreen_ = GURL(); |
251 NotifyTabExclusiveAccessLost(); | 261 NotifyTabExclusiveAccessLost(); |
252 exclusive_access_context->UnhideDownloadShelf(); | |
253 } else { | |
254 exclusive_access_context->HideDownloadShelf(); | |
255 } | 262 } |
256 } | 263 } |
257 | 264 |
258 bool FullscreenController::HandleUserPressedEscape() { | 265 bool FullscreenController::HandleUserPressedEscape() { |
259 WebContents* const active_web_contents = | 266 WebContents* const active_web_contents = |
260 exclusive_access_manager()->context()->GetActiveWebContents(); | 267 exclusive_access_manager()->context()->GetActiveWebContents(); |
261 if (IsFullscreenForCapturedTab(active_web_contents)) { | 268 if (IsFullscreenForCapturedTab(active_web_contents)) { |
262 active_web_contents->ExitFullscreen( | 269 active_web_contents->ExitFullscreen( |
263 /* will_cause_resize */ IsFullscreenCausedByTab()); | 270 /* will_cause_resize */ IsFullscreenCausedByTab()); |
264 return true; | 271 return true; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return fullscreened_origin_; | 454 return fullscreened_origin_; |
448 | 455 |
449 return exclusive_access_tab()->GetLastCommittedURL(); | 456 return exclusive_access_tab()->GetLastCommittedURL(); |
450 } | 457 } |
451 | 458 |
452 GURL FullscreenController::GetEmbeddingOrigin() const { | 459 GURL FullscreenController::GetEmbeddingOrigin() const { |
453 DCHECK(exclusive_access_tab()); | 460 DCHECK(exclusive_access_tab()); |
454 | 461 |
455 return exclusive_access_tab()->GetLastCommittedURL(); | 462 return exclusive_access_tab()->GetLastCommittedURL(); |
456 } | 463 } |
OLD | NEW |