OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/exclusive_access_manager.h" | 5 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
6 | 6 |
| 7 #include "base/command_line.h" |
7 #include "chrome/browser/app_mode/app_mode_utils.h" | 8 #include "chrome/browser/app_mode/app_mode_utils.h" |
8 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | 11 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 12 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
12 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" | 13 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" |
| 14 #include "chrome/common/chrome_switches.h" |
13 | 15 |
14 using content::WebContents; | 16 using content::WebContents; |
15 | 17 |
16 ExclusiveAccessManager::ExclusiveAccessManager( | 18 ExclusiveAccessManager::ExclusiveAccessManager( |
17 ExclusiveAccessContext* exclusive_access_context) | 19 ExclusiveAccessContext* exclusive_access_context) |
18 : exclusive_access_context_(exclusive_access_context), | 20 : exclusive_access_context_(exclusive_access_context), |
19 fullscreen_controller_(this), | 21 fullscreen_controller_(this), |
20 mouse_lock_controller_(this) { | 22 mouse_lock_controller_(this) { |
21 } | 23 } |
22 | 24 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 url, bubble_type); | 79 url, bubble_type); |
78 } | 80 } |
79 | 81 |
80 GURL ExclusiveAccessManager::GetExclusiveAccessBubbleURL() const { | 82 GURL ExclusiveAccessManager::GetExclusiveAccessBubbleURL() const { |
81 GURL result = fullscreen_controller_.GetURLForExclusiveAccessBubble(); | 83 GURL result = fullscreen_controller_.GetURLForExclusiveAccessBubble(); |
82 if (!result.is_valid()) | 84 if (!result.is_valid()) |
83 result = mouse_lock_controller_.GetURLForExclusiveAccessBubble(); | 85 result = mouse_lock_controller_.GetURLForExclusiveAccessBubble(); |
84 return result; | 86 return result; |
85 } | 87 } |
86 | 88 |
| 89 // static |
| 90 bool ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() { |
| 91 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 92 switches::kEnableSimplifiedFullscreenUI)) { |
| 93 return true; |
| 94 } |
| 95 |
| 96 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 97 switches::kDisableSimplifiedFullscreenUI)) { |
| 98 return false; |
| 99 } |
| 100 |
| 101 return false; |
| 102 } |
| 103 |
87 void ExclusiveAccessManager::OnTabDeactivated(WebContents* web_contents) { | 104 void ExclusiveAccessManager::OnTabDeactivated(WebContents* web_contents) { |
88 fullscreen_controller_.OnTabDeactivated(web_contents); | 105 fullscreen_controller_.OnTabDeactivated(web_contents); |
89 mouse_lock_controller_.OnTabDeactivated(web_contents); | 106 mouse_lock_controller_.OnTabDeactivated(web_contents); |
90 } | 107 } |
91 | 108 |
92 void ExclusiveAccessManager::OnTabDetachedFromView(WebContents* web_contents) { | 109 void ExclusiveAccessManager::OnTabDetachedFromView(WebContents* web_contents) { |
93 fullscreen_controller_.OnTabDetachedFromView(web_contents); | 110 fullscreen_controller_.OnTabDetachedFromView(web_contents); |
94 mouse_lock_controller_.OnTabDetachedFromView(web_contents); | 111 mouse_lock_controller_.OnTabDetachedFromView(web_contents); |
95 } | 112 } |
96 | 113 |
(...skipping 21 matching lines...) Expand all Loading... |
118 bool updateBubble = mouse_lock_controller_.OnDenyExclusiveAccessPermission(); | 135 bool updateBubble = mouse_lock_controller_.OnDenyExclusiveAccessPermission(); |
119 updateBubble |= fullscreen_controller_.OnDenyExclusiveAccessPermission(); | 136 updateBubble |= fullscreen_controller_.OnDenyExclusiveAccessPermission(); |
120 if (updateBubble) | 137 if (updateBubble) |
121 UpdateExclusiveAccessExitBubbleContent(); | 138 UpdateExclusiveAccessExitBubbleContent(); |
122 } | 139 } |
123 | 140 |
124 void ExclusiveAccessManager::ExitExclusiveAccess() { | 141 void ExclusiveAccessManager::ExitExclusiveAccess() { |
125 fullscreen_controller_.ExitExclusiveAccessToPreviousState(); | 142 fullscreen_controller_.ExitExclusiveAccessToPreviousState(); |
126 mouse_lock_controller_.LostMouseLock(); | 143 mouse_lock_controller_.LostMouseLock(); |
127 } | 144 } |
OLD | NEW |