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/fullscreen_controller.h" | 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 RenderViewHost* const rvh = exclusive_access_tab()->GetRenderViewHost(); | 215 RenderViewHost* const rvh = exclusive_access_tab()->GetRenderViewHost(); |
216 if (rvh) | 216 if (rvh) |
217 mouse_lock_view = rvh->GetView(); | 217 mouse_lock_view = rvh->GetView(); |
218 } | 218 } |
219 | 219 |
220 if (mouse_lock_view) | 220 if (mouse_lock_view) |
221 mouse_lock_view->UnlockMouse(); | 221 mouse_lock_view->UnlockMouse(); |
222 } | 222 } |
223 | 223 |
224 ContentSetting MouseLockController::GetMouseLockSetting(const GURL& url) const { | 224 ContentSetting MouseLockController::GetMouseLockSetting(const GURL& url) const { |
225 // For file:// URLs, asking for permission would not be meaningful: | |
226 // the preference could be saved for the whole file:// origin, which | |
227 // is overly permissive, or for an individual file:// URL, which would | |
228 // not be meaningful because file:// URLs share an origin. So the only | |
229 // option is to block. This can be revisited when crbug.com/455882 is | |
230 // fixed. | |
231 if (url.SchemeIsFile()) | |
232 return CONTENT_SETTING_BLOCK; | |
meacer
2015/02/10 01:47:21
Blocking this outright makes the fullscreen and po
| |
233 | |
225 if (exclusive_access_manager() | 234 if (exclusive_access_manager() |
226 ->fullscreen_controller() | 235 ->fullscreen_controller() |
227 ->IsPrivilegedFullscreenForTab() || | 236 ->IsPrivilegedFullscreenForTab()) |
228 url.SchemeIsFile()) | |
229 return CONTENT_SETTING_ALLOW; | 237 return CONTENT_SETTING_ALLOW; |
230 | 238 |
231 HostContentSettingsMap* settings_map = profile()->GetHostContentSettingsMap(); | 239 HostContentSettingsMap* settings_map = profile()->GetHostContentSettingsMap(); |
232 return settings_map->GetContentSetting( | 240 return settings_map->GetContentSetting( |
233 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 241 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
234 } | 242 } |
OLD | NEW |