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

Unified Diff: chrome/browser/content_settings/host_content_settings_map.h

Issue 542253003: Add a global on/off switch for content settings and expose a toggle on the Website Settings options… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@global-settings
Patch Set: Created 6 years, 3 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: 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 b5939b5fcaa726af32e01dda82859553ac1b17ad..6154c184d2db00341ff23a03b6c8bc1b2757b26e 100644
--- a/chrome/browser/content_settings/host_content_settings_map.h
+++ b/chrome/browser/content_settings/host_content_settings_map.h
@@ -19,6 +19,7 @@
#include "base/threading/platform_thread.h"
#include "base/tuple.h"
#include "chrome/browser/content_settings/content_settings_observer.h"
+#include "chrome/browser/content_settings/content_settings_override_provider.h"
#include "chrome/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/content_settings/core/common/content_settings_types.h"
@@ -33,6 +34,7 @@ class Value;
}
namespace content_settings {
+class OverrideProvider;
class ProviderInterface;
class PrefProvider;
}
@@ -49,6 +51,7 @@ class HostContentSettingsMap
INTERNAL_EXTENSION_PROVIDER = 0,
POLICY_PROVIDER,
CUSTOM_EXTENSION_PROVIDER,
+ OVERRIDE_PROVIDER,
PREF_PROVIDER,
DEFAULT_PROVIDER,
NUM_PROVIDER_TYPES,
@@ -97,9 +100,8 @@ class HostContentSettingsMap
// setting, NULL is returned and the |source| field of |info| is set to
// |SETTING_SOURCE_NONE|. The pattern fiels of |info| are set to empty
// patterns.
- // The ownership of the resulting |Value| is transfered to the caller.
// May be called on any thread.
- base::Value* GetWebsiteSetting(
+ scoped_ptr<base::Value> GetWebsiteSetting(
const GURL& primary_url,
const GURL& secondary_url,
ContentSettingsType content_type,
@@ -248,6 +250,31 @@ class HostContentSettingsMap
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type);
+ // Returns the content setting without considering the global on/off toggle
+ // for the content setting that matches the URLs.
+ ContentSetting GetContentSettingWithoutOverride(
+ const GURL& primary_url,
+ const GURL& secondary_url,
+ ContentSettingsType content_type,
+ const std::string& resource_identifier);
+
+ // Returns the single content setting |value| without considering the
+ // global on/off toggle for the content setting that matches the given
+ // patterns.
+ scoped_ptr<base::Value> GetWebsiteSettingWithoutOverride(
+ const GURL& primary_url,
+ const GURL& secondary_url,
+ ContentSettingsType content_type,
+ const std::string& resource_identifier,
+ content_settings::SettingInfo* info) const;
+
+ // Sets globally if a given |content_type| |is_enabled|.
+ void SetContentSettingOverride(ContentSettingsType content_type,
+ bool is_enabled);
+
+ // Returns if a given |content_type| is enabled.
+ bool GetContentSettingOverride(ContentSettingsType content_type);
+
// Adds/removes an observer for content settings changes.
void AddObserver(content_settings::Observer* observer);
void RemoveObserver(content_settings::Observer* observer);
@@ -292,6 +319,16 @@ class HostContentSettingsMap
// it is not being called too late.
void UsedContentSettingsProviders() const;
+ // Returns the single content setting |value| with a toggle for if it
+ // takes the global on/off switch into account.
+ scoped_ptr<base::Value> GetWebsiteSettingInternal(
+ const GURL& primary_url,
+ const GURL& secondary_url,
+ ContentSettingsType content_type,
+ const std::string& resource_identifier,
+ content_settings::SettingInfo* info,
+ bool get_override) const;
+
content_settings::PrefProvider* GetPrefProvider();
#ifndef NDEBUG

Powered by Google App Engine
This is Rietveld 408576698