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

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

Issue 949553002: Start using the controller in app's view. Base URL: https://chromium.googlesource.com/chromium/src.git@fsRefactor
Patch Set: 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/exclusive_access_context.h" 10 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Do not store preference on file:// URLs, they don't have a clean 150 // Do not store preference on file:// URLs, they don't have a clean
151 // origin policy. 151 // origin policy.
152 // TODO(estark): Revisit this when crbug.com/455882 is fixed. 152 // TODO(estark): Revisit this when crbug.com/455882 is fixed.
153 if (!url.SchemeIsFile() && pattern.IsValid()) { 153 if (!url.SchemeIsFile() && pattern.IsValid()) {
154 settings_map->SetContentSetting(pattern, 154 settings_map->SetContentSetting(pattern,
155 ContentSettingsPattern::Wildcard(), 155 ContentSettingsPattern::Wildcard(),
156 CONTENT_SETTINGS_TYPE_MOUSELOCK, 156 CONTENT_SETTINGS_TYPE_MOUSELOCK,
157 std::string(), CONTENT_SETTING_ALLOW); 157 std::string(), CONTENT_SETTING_ALLOW);
158 } 158 }
159 159
160 ExclusiveAccessContext* context =
161 exclusive_access_manager()->exclusive_access_context();
160 WebContents* tab = exclusive_access_tab(); 162 WebContents* tab = exclusive_access_tab();
161 if (tab && tab->GotResponseToLockMouseRequest(true)) { 163 if (context->UseCallbackForMouseLock()) {
162 mouse_lock_state_ = MOUSELOCK_ACCEPTED; 164 if (tab && context->MouseLockCallback(true)) {
165 mouse_lock_state_ = MOUSELOCK_ACCEPTED;
166 } else {
167 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED;
168 SetTabWithExclusiveAccess(nullptr);
169 }
163 } else { 170 } else {
164 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; 171 if (tab && tab->GotResponseToLockMouseRequest(true)) {
165 SetTabWithExclusiveAccess(nullptr); 172 mouse_lock_state_ = MOUSELOCK_ACCEPTED;
173 } else {
174 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED;
175 SetTabWithExclusiveAccess(nullptr);
176 }
166 } 177 }
167 NotifyMouseLockChange(); 178 NotifyMouseLockChange();
168 return true; 179 return true;
169 } 180 }
170 181
171 return false; 182 return false;
172 } 183 }
173 184
174 bool MouseLockController::OnDenyExclusiveAccessPermission() { 185 bool MouseLockController::OnDenyExclusiveAccessPermission() {
175 WebContents* tab = exclusive_access_tab(); 186 WebContents* tab = exclusive_access_tab();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 ->IsPrivilegedFullscreenForTab()) 251 ->IsPrivilegedFullscreenForTab())
241 return CONTENT_SETTING_ALLOW; 252 return CONTENT_SETTING_ALLOW;
242 253
243 HostContentSettingsMap* settings_map = exclusive_access_manager() 254 HostContentSettingsMap* settings_map = exclusive_access_manager()
244 ->exclusive_access_context() 255 ->exclusive_access_context()
245 ->GetProfile() 256 ->GetProfile()
246 ->GetHostContentSettingsMap(); 257 ->GetHostContentSettingsMap();
247 return settings_map->GetContentSetting( 258 return settings_map->GetContentSetting(
248 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); 259 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string());
249 } 260 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698