| 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 "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 RenderViewHost* const rvh = exclusive_access_tab()->GetRenderViewHost(); | 236 RenderViewHost* const rvh = exclusive_access_tab()->GetRenderViewHost(); |
| 237 if (rvh) | 237 if (rvh) |
| 238 mouse_lock_view = rvh->GetWidget()->GetView(); | 238 mouse_lock_view = rvh->GetWidget()->GetView(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 if (mouse_lock_view) | 241 if (mouse_lock_view) |
| 242 mouse_lock_view->UnlockMouse(); | 242 mouse_lock_view->UnlockMouse(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 ContentSetting MouseLockController::GetMouseLockSetting(const GURL& url) const { | 245 ContentSetting MouseLockController::GetMouseLockSetting(const GURL& url) const { |
| 246 // If simplified UI is enabled, never ask the user, just auto-allow. We no | 246 // The new policy is to always allow (even if the flag is disabled). We no |
| 247 // longer give users control over this at the settings level (since it is very | 247 // longer give users control over this at the settings level (since it is very |
| 248 // easy to escape mouse lock when it happens). Even if the user has blocked | 248 // easy to escape mouse lock when it happens). Even if the user has blocked |
| 249 // access to this site in the past, we now ignore that setting. | 249 // access to this site in the past, we now ignore that setting. |
| 250 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) | 250 // TODO(mgiuca): Remove this function and clean up callers |
| 251 return CONTENT_SETTING_ALLOW; | 251 // (https://crbug.com/610900). |
| 252 | 252 return CONTENT_SETTING_ALLOW; |
| 253 // Always ask on file:// URLs, since we can't meaningfully make the | |
| 254 // decision stick for a particular origin. | |
| 255 // TODO(estark): Revisit this when crbug.com/455882 is fixed. | |
| 256 if (url.SchemeIsFile()) | |
| 257 return CONTENT_SETTING_ASK; | |
| 258 | |
| 259 if (exclusive_access_manager() | |
| 260 ->fullscreen_controller() | |
| 261 ->IsPrivilegedFullscreenForTab()) | |
| 262 return CONTENT_SETTING_ALLOW; | |
| 263 | |
| 264 HostContentSettingsMap* settings_map = | |
| 265 HostContentSettingsMapFactory::GetForProfile( | |
| 266 exclusive_access_manager()->context()->GetProfile()); | |
| 267 ContentSetting setting = settings_map->GetContentSetting( | |
| 268 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | |
| 269 | |
| 270 return setting; | |
| 271 } | 253 } |
| OLD | NEW |