Chromium Code Reviews| 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/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 | 265 |
| 266 content::RenderWidgetHostView* const current_fs_view = | 266 content::RenderWidgetHostView* const current_fs_view = |
| 267 old_contents->GetFullscreenRenderWidgetHostView(); | 267 old_contents->GetFullscreenRenderWidgetHostView(); |
| 268 if (current_fs_view) | 268 if (current_fs_view) |
| 269 current_fs_view->SetSize(old_contents->GetPreferredSize()); | 269 current_fs_view->SetSize(old_contents->GetPreferredSize()); |
| 270 ResizeWebContents(old_contents, old_contents->GetPreferredSize()); | 270 ResizeWebContents(old_contents, old_contents->GetPreferredSize()); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void FullscreenController::OnTabClosing(WebContents* web_contents) { | 273 void FullscreenController::OnTabClosing(WebContents* web_contents) { |
| 274 if (IsFullscreenForCapturedTab(web_contents)) { | 274 if (IsFullscreenForCapturedTab(web_contents)) { |
| 275 web_contents->ExitFullscreen(); | 275 web_contents->ExitFullscreen(IsFullscreenCausedByTab()); |
|
scheib
2016/01/04 22:26:48
For readability please use the pattern you used be
bokan
2016/01/05 15:37:11
Done.
| |
| 276 } else { | 276 } else { |
| 277 ExclusiveAccessControllerBase::OnTabClosing(web_contents); | 277 ExclusiveAccessControllerBase::OnTabClosing(web_contents); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 void FullscreenController::WindowFullscreenStateChanged() { | 281 void FullscreenController::WindowFullscreenStateChanged() { |
| 282 reentrant_window_state_change_call_check_ = true; | 282 reentrant_window_state_change_call_check_ = true; |
| 283 ExclusiveAccessContext* const exclusive_access_context = | 283 ExclusiveAccessContext* const exclusive_access_context = |
| 284 exclusive_access_manager()->context(); | 284 exclusive_access_manager()->context(); |
| 285 bool exiting_fullscreen = !exclusive_access_context->IsFullscreen(); | 285 bool exiting_fullscreen = !exclusive_access_context->IsFullscreen(); |
| 286 | 286 |
| 287 PostFullscreenChangeNotification(!exiting_fullscreen); | 287 PostFullscreenChangeNotification(!exiting_fullscreen); |
| 288 if (exiting_fullscreen) { | 288 if (exiting_fullscreen) { |
| 289 toggled_into_fullscreen_ = false; | 289 toggled_into_fullscreen_ = false; |
| 290 extension_caused_fullscreen_ = GURL(); | 290 extension_caused_fullscreen_ = GURL(); |
| 291 NotifyTabExclusiveAccessLost(); | 291 NotifyTabExclusiveAccessLost(); |
| 292 exclusive_access_context->UnhideDownloadShelf(); | 292 exclusive_access_context->UnhideDownloadShelf(); |
| 293 } else { | 293 } else { |
| 294 exclusive_access_context->HideDownloadShelf(); | 294 exclusive_access_context->HideDownloadShelf(); |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool FullscreenController::HandleUserPressedEscape() { | 298 bool FullscreenController::HandleUserPressedEscape() { |
| 299 WebContents* const active_web_contents = | 299 WebContents* const active_web_contents = |
| 300 exclusive_access_manager()->context()->GetActiveWebContents(); | 300 exclusive_access_manager()->context()->GetActiveWebContents(); |
| 301 if (IsFullscreenForCapturedTab(active_web_contents)) { | 301 if (IsFullscreenForCapturedTab(active_web_contents)) { |
| 302 active_web_contents->ExitFullscreen(); | 302 active_web_contents->ExitFullscreen(IsFullscreenCausedByTab()); |
|
scheib
2016/01/04 22:26:48
For readability please use the pattern you used be
bokan
2016/01/05 15:37:11
Done.
| |
| 303 return true; | 303 return true; |
| 304 } else if (IsWindowFullscreenForTabOrPending()) { | 304 } else if (IsWindowFullscreenForTabOrPending()) { |
| 305 ExitExclusiveAccessIfNecessary(); | 305 ExitExclusiveAccessIfNecessary(); |
| 306 return true; | 306 return true; |
| 307 } | 307 } |
| 308 | 308 |
| 309 return false; | 309 return false; |
| 310 } | 310 } |
| 311 | 311 |
| 312 void FullscreenController::ExitExclusiveAccessToPreviousState() { | 312 void FullscreenController::ExitExclusiveAccessToPreviousState() { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 401 chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
| 402 content::Source<FullscreenController>(this), | 402 content::Source<FullscreenController>(this), |
| 403 content::Details<bool>(&is_fullscreen)); | 403 content::Details<bool>(&is_fullscreen)); |
| 404 } | 404 } |
| 405 | 405 |
| 406 void FullscreenController::NotifyTabExclusiveAccessLost() { | 406 void FullscreenController::NotifyTabExclusiveAccessLost() { |
| 407 if (exclusive_access_tab()) { | 407 if (exclusive_access_tab()) { |
| 408 WebContents* web_contents = exclusive_access_tab(); | 408 WebContents* web_contents = exclusive_access_tab(); |
| 409 SetTabWithExclusiveAccess(nullptr); | 409 SetTabWithExclusiveAccess(nullptr); |
| 410 fullscreened_origin_ = GURL(); | 410 fullscreened_origin_ = GURL(); |
| 411 bool will_cause_resize = IsFullscreenCausedByTab(); | |
| 411 state_prior_to_tab_fullscreen_ = STATE_INVALID; | 412 state_prior_to_tab_fullscreen_ = STATE_INVALID; |
| 412 tab_fullscreen_accepted_ = false; | 413 tab_fullscreen_accepted_ = false; |
| 413 web_contents->ExitFullscreen(); | 414 web_contents->ExitFullscreen(will_cause_resize); |
| 414 exclusive_access_manager()->UpdateExclusiveAccessExitBubbleContent(); | 415 exclusive_access_manager()->UpdateExclusiveAccessExitBubbleContent(); |
| 415 } | 416 } |
| 416 } | 417 } |
| 417 | 418 |
| 418 void FullscreenController::ToggleFullscreenModeInternal( | 419 void FullscreenController::ToggleFullscreenModeInternal( |
| 419 FullscreenInternalOption option) { | 420 FullscreenInternalOption option) { |
| 420 #if defined(OS_WIN) | 421 #if defined(OS_WIN) |
| 421 // When in Metro snap mode, toggling in and out of fullscreen is prevented. | 422 // When in Metro snap mode, toggling in and out of fullscreen is prevented. |
| 422 if (IsInMetroSnapMode()) | 423 if (IsInMetroSnapMode()) |
| 423 return; | 424 return; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 596 return fullscreened_origin_; | 597 return fullscreened_origin_; |
| 597 | 598 |
| 598 return exclusive_access_tab()->GetLastCommittedURL(); | 599 return exclusive_access_tab()->GetLastCommittedURL(); |
| 599 } | 600 } |
| 600 | 601 |
| 601 GURL FullscreenController::GetEmbeddingOrigin() const { | 602 GURL FullscreenController::GetEmbeddingOrigin() const { |
| 602 DCHECK(exclusive_access_tab()); | 603 DCHECK(exclusive_access_tab()); |
| 603 | 604 |
| 604 return exclusive_access_tab()->GetLastCommittedURL(); | 605 return exclusive_access_tab()->GetLastCommittedURL(); |
| 605 } | 606 } |
| OLD | NEW |