Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Side by Side Diff: chrome/browser/ui/exclusive_access/mouse_lock_controller.cc

Issue 903683005: Always prompt for permission on fullscreen and mouse lock on file:// URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unit test for permissions menu for fullscreen/mouse lock on file:// Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (mouse_lock && !IsMouseLocked()) { 136 if (mouse_lock && !IsMouseLocked()) {
137 DCHECK(IsMouseLockRequested()); 137 DCHECK(IsMouseLockRequested());
138 138
139 HostContentSettingsMap* settings_map = 139 HostContentSettingsMap* settings_map =
140 profile()->GetHostContentSettingsMap(); 140 profile()->GetHostContentSettingsMap();
141 141
142 GURL url = GetExclusiveAccessBubbleURL(); 142 GURL url = GetExclusiveAccessBubbleURL();
143 ContentSettingsPattern pattern = ContentSettingsPattern::FromURL(url); 143 ContentSettingsPattern pattern = ContentSettingsPattern::FromURL(url);
144 144
145 // TODO(markusheintz): We should allow patterns for all possible URLs here. 145 // TODO(markusheintz): We should allow patterns for all possible URLs here.
146 if (pattern.IsValid()) { 146 if (!url.SchemeIsFile() && pattern.IsValid()) {
scheib 2015/02/11 16:48:34 Add comment along lines of: "Do not store preferen
estark 2015/02/11 21:21:58 Done.
147 settings_map->SetContentSetting(pattern, 147 settings_map->SetContentSetting(pattern,
148 ContentSettingsPattern::Wildcard(), 148 ContentSettingsPattern::Wildcard(),
149 CONTENT_SETTINGS_TYPE_MOUSELOCK, 149 CONTENT_SETTINGS_TYPE_MOUSELOCK,
150 std::string(), CONTENT_SETTING_ALLOW); 150 std::string(), CONTENT_SETTING_ALLOW);
151 } 151 }
152 152
153 WebContents* tab = exclusive_access_tab(); 153 WebContents* tab = exclusive_access_tab();
154 if (tab && tab->GotResponseToLockMouseRequest(true)) { 154 if (tab && tab->GotResponseToLockMouseRequest(true)) {
155 mouse_lock_state_ = MOUSELOCK_ACCEPTED; 155 mouse_lock_state_ = MOUSELOCK_ACCEPTED;
156 } else { 156 } else {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Always ask on file:// URLs, since we can't meaningfully make the
226 // decision stick for a particular origin.
227 // TODO(estark): Revisit this when crbug.com/455882 is fixed.
228 if (url.SchemeIsFile())
229 return CONTENT_SETTING_ASK;
230
225 if (exclusive_access_manager() 231 if (exclusive_access_manager()
226 ->fullscreen_controller() 232 ->fullscreen_controller()
227 ->IsPrivilegedFullscreenForTab() || 233 ->IsPrivilegedFullscreenForTab())
228 url.SchemeIsFile())
229 return CONTENT_SETTING_ALLOW; 234 return CONTENT_SETTING_ALLOW;
230 235
231 HostContentSettingsMap* settings_map = profile()->GetHostContentSettingsMap(); 236 HostContentSettingsMap* settings_map = profile()->GetHostContentSettingsMap();
232 return settings_map->GetContentSetting( 237 return settings_map->GetContentSetting(
233 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); 238 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string());
234 } 239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698