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/message_loop/message_loop.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" |
10 #include "chrome/browser/app_mode/app_mode_utils.h" | 12 #include "chrome/browser/app_mode/app_mode_utils.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | 15 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
14 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 16 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
15 #include "chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h" | 17 #include "chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h" |
16 #include "chrome/browser/ui/status_bubble.h" | 18 #include "chrome/browser/ui/status_bubble.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/browser/ui/web_contents_sizer.h" | 20 #include "chrome/browser/ui/web_contents_sizer.h" |
19 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 384 |
383 void FullscreenController::ExitExclusiveAccessIfNecessary() { | 385 void FullscreenController::ExitExclusiveAccessIfNecessary() { |
384 if (IsWindowFullscreenForTabOrPending()) | 386 if (IsWindowFullscreenForTabOrPending()) |
385 ExitFullscreenModeForTab(exclusive_access_tab()); | 387 ExitFullscreenModeForTab(exclusive_access_tab()); |
386 else | 388 else |
387 NotifyTabExclusiveAccessLost(); | 389 NotifyTabExclusiveAccessLost(); |
388 } | 390 } |
389 | 391 |
390 void FullscreenController::PostFullscreenChangeNotification( | 392 void FullscreenController::PostFullscreenChangeNotification( |
391 bool is_fullscreen) { | 393 bool is_fullscreen) { |
392 base::MessageLoop::current()->PostTask( | 394 base::ThreadTaskRunnerHandle::Get()->PostTask( |
393 FROM_HERE, | 395 FROM_HERE, base::Bind(&FullscreenController::NotifyFullscreenChange, |
394 base::Bind(&FullscreenController::NotifyFullscreenChange, | 396 ptr_factory_.GetWeakPtr(), is_fullscreen)); |
395 ptr_factory_.GetWeakPtr(), | |
396 is_fullscreen)); | |
397 } | 397 } |
398 | 398 |
399 void FullscreenController::NotifyFullscreenChange(bool is_fullscreen) { | 399 void FullscreenController::NotifyFullscreenChange(bool is_fullscreen) { |
400 content::NotificationService::current()->Notify( | 400 content::NotificationService::current()->Notify( |
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() { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 return fullscreened_origin_; | 594 return fullscreened_origin_; |
595 | 595 |
596 return exclusive_access_tab()->GetLastCommittedURL(); | 596 return exclusive_access_tab()->GetLastCommittedURL(); |
597 } | 597 } |
598 | 598 |
599 GURL FullscreenController::GetEmbeddingOrigin() const { | 599 GURL FullscreenController::GetEmbeddingOrigin() const { |
600 DCHECK(exclusive_access_tab()); | 600 DCHECK(exclusive_access_tab()); |
601 | 601 |
602 return exclusive_access_tab()->GetLastCommittedURL(); | 602 return exclusive_access_tab()->GetLastCommittedURL(); |
603 } | 603 } |
OLD | NEW |