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..915c4a7582da102720c2dd9bdb0aecd22d816c5d 100644 |
--- a/chrome/browser/content_settings/host_content_settings_map.h |
+++ b/chrome/browser/content_settings/host_content_settings_map.h |
@@ -27,11 +27,13 @@ class GURL; |
class PrefService; |
namespace base { |
+class Clock; |
class Value; |
} |
namespace content_settings { |
class ProviderInterface; |
+class PrefProvider; |
} |
namespace user_prefs { |
@@ -199,6 +201,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(scoped_ptr<base::Clock> clock); |
+ |
private: |
friend class base::RefCountedThreadSafe<HostContentSettingsMap>; |
friend class HostContentSettingsMapTest_NonDefaultSettings_Test; |
@@ -236,6 +271,14 @@ 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); |
+ |
+ content_settings::PrefProvider* GetPrefProvider(); |
+ |
#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 |