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

Unified 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: add migrate method Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/content_settings/core/browser/host_content_settings_map.h
diff --git a/components/content_settings/core/browser/host_content_settings_map.h b/components/content_settings/core/browser/host_content_settings_map.h
index 98fe724f79dc75b7aa9aebc0b87c4d8e0ebe80cc..6ecd0c7e4dbf006cc4a93ee16ab247355b15a3d8 100644
--- a/components/content_settings/core/browser/host_content_settings_map.h
+++ b/components/content_settings/core/browser/host_content_settings_map.h
@@ -140,14 +140,62 @@ class HostContentSettingsMap : public content_settings::Observer,
// data types please use the method SetWebsiteSettingDefaultScope().
//
// This should only be called on the UI thread.
- // TODO(raymes): Create a version of this function which uses the default
- // scope.
void SetContentSetting(const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type,
const std::string& resource_identifier,
ContentSetting setting);
+ // Sets the content |setting| for the default scope of the url that is
+ // appropriate for the given |content_type| and |resource_identifier|.
+ // Setting the value to CONTENT_SETTING_DEFAULT causes the default setting
+ // for that type to be used.
+ //
+ // NOTICE: This is just a convenience method for content types that use
+ // |CONTENT_SETTING| as their data type. For content types that use other
+ // data types please use the method SetWebsiteSettingDefaultScope().
+ //
+ // This should only be called on the UI thread.
+ //
+ // Internally this will call SetContentSettingCustomScope() with the default
+ // scope patterns for the given |content_type|. Developers will generally want
+ // to use this function instead of SetContentSettingCustomScope() unless they
+ // need to specify custom scoping.
+ void SetContentSettingDefaultScope(const GURL& primary_url,
+ const GURL& secondary_url,
+ ContentSettingsType content_type,
+ const std::string& resource_identifier,
+ ContentSetting setting);
+
+ // Sets the content |setting| for the given patterns, |content_type| and
+ // |resource_identifier|. Setting the value to CONTENT_SETTING_DEFAULT causes
+ // the default setting for that type to be used when loading pages matching
+ // this pattern.
+ // NOTICE: This is just a convenience method for content types that use
+ // |CONTENT_SETTING| as their data type. For content types that use other
+ // data types please use the method SetWebsiteSettingDefaultScope().
+ //
+ // This should only be called on the UI thread.
+ //
+ // Unless adding a custom-scoped setting, most developers will want to use
+ // SetWebsiteSettingDefaultScope() instead.
+ void SetContentSettingCustomScope(
+ const ContentSettingsPattern& primary_pattern,
+ const ContentSettingsPattern& secondary_pattern,
+ ContentSettingsType content_type,
+ const std::string& resource_identifier,
+ ContentSetting setting);
+
+ // Migrate old settings for those ContentSettingsType which previously
+ // would use the same pattern twice instead of using
+ // ContentSettingsPattern::Wildcard(). This has no impact on lookups using
+ // GetContentSetting (because Wildcard matches everything) but it has an
+ // impact when trying to change the existing content setting. We need to
+ // migrate the old-format keys.
+ // TODO(lshang): Remove this when clients have migrated. We should leave in
+ // some code to remove old-format settings for a long time.
+ void MigrateOldSettings();
+
// Sets the |value| for the default scope of the url that is appropriate for
// the given |content_type| and |resource_identifier|. Setting the value to
// null removes the default pattern pair for this content type.

Powered by Google App Engine
This is Rietveld 408576698