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

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

Issue 1312453005: Removed Profile::GetHostContentSettingsMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict Created 5 years, 3 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/content_settings/host_content_settings_map_factory.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" 11 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
11 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" 12 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
12 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 13 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
13 #include "components/content_settings/core/browser/host_content_settings_map.h" 14 #include "components/content_settings/core/browser/host_content_settings_map.h"
14 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
15 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/render_widget_host_view.h" 17 #include "content/public/browser/render_widget_host_view.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ExclusiveAccessBubbleType bubble_type = 131 ExclusiveAccessBubbleType bubble_type =
131 exclusive_access_manager()->GetExclusiveAccessExitBubbleType(); 132 exclusive_access_manager()->GetExclusiveAccessExitBubbleType();
132 bool mouse_lock = false; 133 bool mouse_lock = false;
133 exclusive_access_bubble::PermissionRequestedByType(bubble_type, nullptr, 134 exclusive_access_bubble::PermissionRequestedByType(bubble_type, nullptr,
134 &mouse_lock); 135 &mouse_lock);
135 DCHECK(!(mouse_lock && IsMouseLocked())); 136 DCHECK(!(mouse_lock && IsMouseLocked()));
136 137
137 if (mouse_lock && !IsMouseLocked()) { 138 if (mouse_lock && !IsMouseLocked()) {
138 DCHECK(IsMouseLockRequested()); 139 DCHECK(IsMouseLockRequested());
139 140
140 HostContentSettingsMap* settings_map = exclusive_access_manager() 141 HostContentSettingsMap* settings_map =
141 ->context() 142 HostContentSettingsMapFactory::GetForProfile(
142 ->GetProfile() 143 exclusive_access_manager()->context()->GetProfile());
143 ->GetHostContentSettingsMap();
144 144
145 GURL url = GetExclusiveAccessBubbleURL(); 145 GURL url = GetExclusiveAccessBubbleURL();
146 ContentSettingsPattern pattern = ContentSettingsPattern::FromURL(url); 146 ContentSettingsPattern pattern = ContentSettingsPattern::FromURL(url);
147 147
148 // TODO(markusheintz): We should allow patterns for all possible URLs here. 148 // TODO(markusheintz): We should allow patterns for all possible URLs here.
149 // 149 //
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()) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // decision stick for a particular origin. 238 // decision stick for a particular origin.
239 // TODO(estark): Revisit this when crbug.com/455882 is fixed. 239 // TODO(estark): Revisit this when crbug.com/455882 is fixed.
240 if (url.SchemeIsFile() && !simplified_ui) 240 if (url.SchemeIsFile() && !simplified_ui)
241 return CONTENT_SETTING_ASK; 241 return CONTENT_SETTING_ASK;
242 242
243 if (exclusive_access_manager() 243 if (exclusive_access_manager()
244 ->fullscreen_controller() 244 ->fullscreen_controller()
245 ->IsPrivilegedFullscreenForTab()) 245 ->IsPrivilegedFullscreenForTab())
246 return CONTENT_SETTING_ALLOW; 246 return CONTENT_SETTING_ALLOW;
247 247
248 HostContentSettingsMap* settings_map = exclusive_access_manager() 248 HostContentSettingsMap* settings_map =
249 ->context() 249 HostContentSettingsMapFactory::GetForProfile(
250 ->GetProfile() 250 exclusive_access_manager()->context()->GetProfile());
251 ->GetHostContentSettingsMap();
252 ContentSetting setting = settings_map->GetContentSetting( 251 ContentSetting setting = settings_map->GetContentSetting(
253 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); 252 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string());
254 253
255 if (simplified_ui && setting == CONTENT_SETTING_ASK) 254 if (simplified_ui && setting == CONTENT_SETTING_ASK)
256 return CONTENT_SETTING_ALLOW; 255 return CONTENT_SETTING_ALLOW;
257 256
258 return setting; 257 return setting;
259 } 258 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698