| Index: chrome/browser/content_settings/host_content_settings_map.h
|
| diff --git a/chrome/browser/content_settings/host_content_settings_map.h b/chrome/browser/content_settings/host_content_settings_map.h
|
| index 8d5681a1536a92a9e18978146b253f66554431db..96cc886b7fee164229e19b9d9183577f13384930 100644
|
| --- a/chrome/browser/content_settings/host_content_settings_map.h
|
| +++ b/chrome/browser/content_settings/host_content_settings_map.h
|
| @@ -27,6 +27,7 @@ class GURL;
|
| class PrefService;
|
|
|
| namespace base {
|
| +class Clock;
|
| class Value;
|
| }
|
|
|
| @@ -199,6 +200,39 @@ class HostContentSettingsMap
|
| return is_off_the_record_;
|
| }
|
|
|
| + // Returns a single |ContentSetting| which applies to the given URLs, just as
|
| + // |GetContentSetting| does. If the setting is allowed, it also records the
|
| + // last usage to preferences.
|
| + //
|
| + // This should only be called on the UI thread, unlike |GetContentSetting|.
|
| + ContentSetting GetContentSettingAndMaybeUpdateLastUsage(
|
| + const GURL& primary_url,
|
| + const GURL& secondary_url,
|
| + ContentSettingsType content_type,
|
| + const std::string& resource_identifier);
|
| +
|
| + // Sets the last time that a given content type has been used for the pattern
|
| + // which matches the URLs to the current time.
|
| + void UpdateLastUsage(const GURL& primary_url,
|
| + const GURL& secondary_url,
|
| + ContentSettingsType content_type);
|
| +
|
| + // Returns the last time the pattern that matches the URL has requested
|
| + // permission for the |content_type| setting.
|
| + base::Time GetLastUsage(const GURL& primary_url,
|
| + const GURL& secondary_url,
|
| + ContentSettingsType content_type);
|
| +
|
| + // Returns the last time the pattern has requested permission for the
|
| + // |content_type| setting.
|
| + base::Time GetLastUsageByPattern(
|
| + const ContentSettingsPattern& primary_pattern,
|
| + const ContentSettingsPattern& secondary_pattern,
|
| + ContentSettingsType content_type);
|
| +
|
| + // Passes ownership of |clock|.
|
| + void SetPrefClockForTesting(base::Clock* clock);
|
| +
|
| private:
|
| friend class base::RefCountedThreadSafe<HostContentSettingsMap>;
|
| friend class HostContentSettingsMapTest_NonDefaultSettings_Test;
|
| @@ -236,6 +270,12 @@ class HostContentSettingsMap
|
| // it is not being called too late.
|
| void UsedContentSettingsProviders() const;
|
|
|
| + // Convenience method for updating the last usage of a content type for a
|
| + // pattern.
|
| + void UpdateLastUsageByPattern(const ContentSettingsPattern& primary_pattern,
|
| + const ContentSettingsPattern& secondary_pattern,
|
| + ContentSettingsType content_type);
|
| +
|
| #ifndef NDEBUG
|
| // This starts as the thread ID of the thread that constructs this
|
| // object, and remains until used by a different thread, at which
|
|
|