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 auto* exclusive_access_context = exclusive_access_manager()->context(); | |
Nico
2017/02/17 15:53:46
nit: style guide says "only use auto if type obvio
Sidney San Martín
2017/02/17 16:07:08
Done.
| |
243 if (exclusive_access_context->IsFullscreen()) { | |
244 exclusive_access_context->HideDownloadShelf(); | |
245 } else { | |
246 exclusive_access_context->UnhideDownloadShelf(); | |
247 } | |
248 } | |
249 | |
241 void FullscreenController::WindowFullscreenStateChanged() { | 250 void FullscreenController::WindowFullscreenStateChanged() { |
242 reentrant_window_state_change_call_check_ = true; | 251 reentrant_window_state_change_call_check_ = true; |
243 ExclusiveAccessContext* const exclusive_access_context = | 252 ExclusiveAccessContext* const exclusive_access_context = |
244 exclusive_access_manager()->context(); | 253 exclusive_access_manager()->context(); |
245 bool exiting_fullscreen = !exclusive_access_context->IsFullscreen(); | 254 bool exiting_fullscreen = !exclusive_access_context->IsFullscreen(); |
246 | 255 |
247 PostFullscreenChangeNotification(!exiting_fullscreen); | 256 PostFullscreenChangeNotification(!exiting_fullscreen); |
248 if (exiting_fullscreen) { | 257 if (exiting_fullscreen) { |
249 toggled_into_fullscreen_ = false; | 258 toggled_into_fullscreen_ = false; |
250 extension_caused_fullscreen_ = GURL(); | 259 extension_caused_fullscreen_ = GURL(); |
251 NotifyTabExclusiveAccessLost(); | 260 NotifyTabExclusiveAccessLost(); |
252 exclusive_access_context->UnhideDownloadShelf(); | |
253 } else { | |
254 exclusive_access_context->HideDownloadShelf(); | |
255 } | 261 } |
256 } | 262 } |
257 | 263 |
258 bool FullscreenController::HandleUserPressedEscape() { | 264 bool FullscreenController::HandleUserPressedEscape() { |
259 WebContents* const active_web_contents = | 265 WebContents* const active_web_contents = |
260 exclusive_access_manager()->context()->GetActiveWebContents(); | 266 exclusive_access_manager()->context()->GetActiveWebContents(); |
261 if (IsFullscreenForCapturedTab(active_web_contents)) { | 267 if (IsFullscreenForCapturedTab(active_web_contents)) { |
262 active_web_contents->ExitFullscreen( | 268 active_web_contents->ExitFullscreen( |
263 /* will_cause_resize */ IsFullscreenCausedByTab()); | 269 /* will_cause_resize */ IsFullscreenCausedByTab()); |
264 return true; | 270 return true; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 return fullscreened_origin_; | 453 return fullscreened_origin_; |
448 | 454 |
449 return exclusive_access_tab()->GetLastCommittedURL(); | 455 return exclusive_access_tab()->GetLastCommittedURL(); |
450 } | 456 } |
451 | 457 |
452 GURL FullscreenController::GetEmbeddingOrigin() const { | 458 GURL FullscreenController::GetEmbeddingOrigin() const { |
453 DCHECK(exclusive_access_tab()); | 459 DCHECK(exclusive_access_tab()); |
454 | 460 |
455 return exclusive_access_tab()->GetLastCommittedURL(); | 461 return exclusive_access_tab()->GetLastCommittedURL(); |
456 } | 462 } |
OLD | NEW |