| 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/mouse_lock_controller.h" | 5 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | 10 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 RenderViewHost* const rvh = exclusive_access_tab()->GetRenderViewHost(); | 222 RenderViewHost* const rvh = exclusive_access_tab()->GetRenderViewHost(); |
| 223 if (rvh) | 223 if (rvh) |
| 224 mouse_lock_view = rvh->GetView(); | 224 mouse_lock_view = rvh->GetView(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 if (mouse_lock_view) | 227 if (mouse_lock_view) |
| 228 mouse_lock_view->UnlockMouse(); | 228 mouse_lock_view->UnlockMouse(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 ContentSetting MouseLockController::GetMouseLockSetting(const GURL& url) const { | 231 ContentSetting MouseLockController::GetMouseLockSetting(const GURL& url) const { |
| 232 // If simplified UI is enabled, never ask the user, just auto-allow. (Always |
| 233 // return CONTENT_SETTING_ALLOW in favour of CONTENT_SETTING_ASK.) |
| 234 bool simplified_ui = |
| 235 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled(); |
| 236 |
| 232 // Always ask on file:// URLs, since we can't meaningfully make the | 237 // Always ask on file:// URLs, since we can't meaningfully make the |
| 233 // decision stick for a particular origin. | 238 // decision stick for a particular origin. |
| 234 // TODO(estark): Revisit this when crbug.com/455882 is fixed. | 239 // TODO(estark): Revisit this when crbug.com/455882 is fixed. |
| 235 if (url.SchemeIsFile()) | 240 if (url.SchemeIsFile() && !simplified_ui) |
| 236 return CONTENT_SETTING_ASK; | 241 return CONTENT_SETTING_ASK; |
| 237 | 242 |
| 238 if (exclusive_access_manager() | 243 if (exclusive_access_manager() |
| 239 ->fullscreen_controller() | 244 ->fullscreen_controller() |
| 240 ->IsPrivilegedFullscreenForTab()) | 245 ->IsPrivilegedFullscreenForTab()) |
| 241 return CONTENT_SETTING_ALLOW; | 246 return CONTENT_SETTING_ALLOW; |
| 242 | 247 |
| 243 HostContentSettingsMap* settings_map = exclusive_access_manager() | 248 HostContentSettingsMap* settings_map = exclusive_access_manager() |
| 244 ->context() | 249 ->context() |
| 245 ->GetProfile() | 250 ->GetProfile() |
| 246 ->GetHostContentSettingsMap(); | 251 ->GetHostContentSettingsMap(); |
| 247 return settings_map->GetContentSetting( | 252 ContentSetting setting = settings_map->GetContentSetting( |
| 248 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 253 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
| 254 |
| 255 if (simplified_ui && setting == CONTENT_SETTING_ASK) |
| 256 return CONTENT_SETTING_ALLOW; |
| 257 |
| 258 return setting; |
| 249 } | 259 } |
| OLD | NEW |