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

Side by Side Diff: chrome/browser/permissions/permission_context_base.cc

Issue 1382783002: Store USB device permissions in website settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert WebUSBPermissionStore to a PermissionContext. Created 5 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/permissions/permission_context_base.h" 5 #include "chrome/browser/permissions/permission_context_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.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/permissions/permission_context_uma_util.h" 10 #include "chrome/browser/permissions/permission_context_uma_util.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 #if defined(OS_ANDROID) 208 #if defined(OS_ANDROID)
209 PermissionQueueController* PermissionContextBase::GetQueueController() { 209 PermissionQueueController* PermissionContextBase::GetQueueController() {
210 return permission_queue_controller_.get(); 210 return permission_queue_controller_.get();
211 } 211 }
212 #endif 212 #endif
213 213
214 Profile* PermissionContextBase::profile() const { 214 Profile* PermissionContextBase::profile() const {
215 return profile_; 215 return profile_;
216 } 216 }
217 217
218 ContentSettingsType PermissionContextBase::type() const {
219 return permission_type_;
220 }
221
218 void PermissionContextBase::NotifyPermissionSet( 222 void PermissionContextBase::NotifyPermissionSet(
219 const PermissionRequestID& id, 223 const PermissionRequestID& id,
220 const GURL& requesting_origin, 224 const GURL& requesting_origin,
221 const GURL& embedding_origin, 225 const GURL& embedding_origin,
222 const BrowserPermissionCallback& callback, 226 const BrowserPermissionCallback& callback,
223 bool persist, 227 bool persist,
224 ContentSetting content_setting) { 228 ContentSetting content_setting) {
225 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 229 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
226 230
227 if (persist) 231 if (persist)
(...skipping 24 matching lines...) Expand all
252 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); 256 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin());
253 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); 257 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin());
254 DCHECK(content_setting == CONTENT_SETTING_ALLOW || 258 DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
255 content_setting == CONTENT_SETTING_BLOCK); 259 content_setting == CONTENT_SETTING_BLOCK);
256 260
257 HostContentSettingsMapFactory::GetForProfile(profile_)->SetContentSetting( 261 HostContentSettingsMapFactory::GetForProfile(profile_)->SetContentSetting(
258 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), 262 ContentSettingsPattern::FromURLNoWildcard(requesting_origin),
259 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), 263 ContentSettingsPattern::FromURLNoWildcard(embedding_origin),
260 permission_type_, std::string(), content_setting); 264 permission_type_, std::string(), content_setting);
261 } 265 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698