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

Side by Side Diff: components/content_settings/core/browser/host_content_settings_map.h

Issue 1686343002: Change HostContentSettingsMap::SetContentSetting to use GURLs instead of patterns (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: divide the CL and change to use DefaultScope in unit tests Created 4 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Maps hostnames to custom content settings. Written on the UI thread and read 5 // Maps hostnames to custom content settings. Written on the UI thread and read
6 // on any thread. One instance per profile. 6 // on any thread. One instance per profile.
7 7
8 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ 8 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_
9 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ 9 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_
10 10
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 // Sets the content |setting| for the given patterns, |content_type| and 134 // Sets the content |setting| for the given patterns, |content_type| and
135 // |resource_identifier|. Setting the value to CONTENT_SETTING_DEFAULT causes 135 // |resource_identifier|. Setting the value to CONTENT_SETTING_DEFAULT causes
136 // the default setting for that type to be used when loading pages matching 136 // the default setting for that type to be used when loading pages matching
137 // this pattern. 137 // this pattern.
138 // NOTICE: This is just a convenience method for content types that use 138 // NOTICE: This is just a convenience method for content types that use
139 // |CONTENT_SETTING| as their data type. For content types that use other 139 // |CONTENT_SETTING| as their data type. For content types that use other
140 // data types please use the method SetWebsiteSettingDefaultScope(). 140 // data types please use the method SetWebsiteSettingDefaultScope().
141 // 141 //
142 // This should only be called on the UI thread. 142 // This should only be called on the UI thread.
143 // TODO(raymes): Create a version of this function which uses the default 143 // Unless adding a custom-scoped setting, most developers will want to use
144 // scope. 144 // SetWebsiteSettingDefaultScope() instead.
raymes 2016/03/02 04:22:51 nit: Perhaps move this up to line 137 after the pr
raymes 2016/03/02 04:22:51 nit: SetWebsiteSettingDefaultScope
lshang 2016/03/02 05:21:56 Done.
145 void SetContentSetting(const ContentSettingsPattern& primary_pattern, 145 void SetContentSetting(const ContentSettingsPattern& primary_pattern,
146 const ContentSettingsPattern& secondary_pattern, 146 const ContentSettingsPattern& secondary_pattern,
147 ContentSettingsType content_type, 147 ContentSettingsType content_type,
148 const std::string& resource_identifier, 148 const std::string& resource_identifier,
149 ContentSetting setting); 149 ContentSetting setting);
150 150
151 // Sets the content |setting| for the default scope of the url that is
152 // appropriate for the given |content_type| and |resource_identifier|.
153 // Setting the value to CONTENT_SETTING_DEFAULT causes the default setting
154 // for that type to be used.
155 //
156 // NOTICE: This is just a convenience method for content types that use
157 // |CONTENT_SETTING| as their data type. For content types that use other
158 // data types please use the method SetWebsiteSettingDefaultScope().
159 //
160 // This should only be called on the UI thread.
161 //
162 // Internally this will call SetContentSetting() with the default scope
163 // patterns for the given |content_type|. Developers will generally want
164 // to use this function instead of SetContentSetting() unless they need
165 // to specify custom scoping.
166 void SetContentSettingDefaultScope(const GURL& primary_url,
167 const GURL& secondary_url,
168 ContentSettingsType content_type,
169 const std::string& resource_identifier,
170 ContentSetting setting);
171
151 // Sets the |value| for the default scope of the url that is appropriate for 172 // Sets the |value| for the default scope of the url that is appropriate for
152 // the given |content_type| and |resource_identifier|. Setting the value to 173 // the given |content_type| and |resource_identifier|. Setting the value to
153 // null removes the default pattern pair for this content type. 174 // null removes the default pattern pair for this content type.
154 // 175 //
155 // Internally this will call SetWebsiteSettingCustomScope() with the default 176 // Internally this will call SetWebsiteSettingCustomScope() with the default
156 // scope patterns for the given |content_type|. Developers will generally want 177 // scope patterns for the given |content_type|. Developers will generally want
157 // to use this function instead of SetWebsiteSettingCustomScope() unless they 178 // to use this function instead of SetWebsiteSettingCustomScope() unless they
158 // need to specify custom scoping. 179 // need to specify custom scoping.
159 void SetWebsiteSettingDefaultScope(const GURL& requesting_url, 180 void SetWebsiteSettingDefaultScope(const GURL& requesting_url,
160 const GURL& top_level_url, 181 const GURL& top_level_url,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 ProviderMap content_settings_providers_; 362 ProviderMap content_settings_providers_;
342 363
343 base::ThreadChecker thread_checker_; 364 base::ThreadChecker thread_checker_;
344 365
345 base::ObserverList<content_settings::Observer> observers_; 366 base::ObserverList<content_settings::Observer> observers_;
346 367
347 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); 368 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap);
348 }; 369 };
349 370
350 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ 371 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698