Skip to content

Commit

Permalink
Use BraveInit() to unregister and register the default registry value
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdh committed Aug 1, 2018
1 parent 1154635 commit a85e50e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "../../../../../../components/content_settings/core/browser/content_settings_registry.cc"

namespace content_settings {

void ContentSettingsRegistry::BraveInit() {
// Add CONTENT_SETTING_ASK and make it default for autoplay
content_settings_info_.erase(CONTENT_SETTINGS_TYPE_AUTOPLAY);
website_settings_registry_->UnRegister(CONTENT_SETTINGS_TYPE_AUTOPLAY);
Register(CONTENT_SETTINGS_TYPE_AUTOPLAY, "autoplay", CONTENT_SETTING_ASK,
WebsiteSettingsInfo::UNSYNCABLE, WhitelistedSchemes(),
ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK,
CONTENT_SETTING_ASK),
WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE,
WebsiteSettingsRegistry::DESKTOP |
WebsiteSettingsRegistry::PLATFORM_ANDROID,
ContentSettingsInfo::INHERIT_IN_INCOGNITO);

}

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
index 6a0478a2e2dad6a715aaedf35a52d09612340881..2b4e6649c53cf74c4f0d9652f30306460e4a916c 100644
index 6a0478a2e2dad6a715aaedf35a52d09612340881..de60070c9bdb424497d51d51f7db0bed85e15ffa 100644
--- a/components/content_settings/core/browser/content_settings_registry.cc
+++ b/components/content_settings/core/browser/content_settings_registry.cc
@@ -265,9 +265,9 @@ void ContentSettingsRegistry::Init() {
WebsiteSettingsRegistry::PLATFORM_ANDROID,
ContentSettingsInfo::INHERIT_IN_INCOGNITO);

- Register(CONTENT_SETTINGS_TYPE_AUTOPLAY, "autoplay", CONTENT_SETTING_ALLOW,
+ Register(CONTENT_SETTINGS_TYPE_AUTOPLAY, "autoplay", CONTENT_SETTING_ASK,
WebsiteSettingsInfo::UNSYNCABLE, WhitelistedSchemes(),
- ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK),
+ ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK),
WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE,
@@ -361,6 +361,7 @@ void ContentSettingsRegistry::Init() {
WebsiteSettingsRegistry::DESKTOP |
WebsiteSettingsRegistry::PLATFORM_ANDROID,
ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE);
+ BraveInit();
}

void ContentSettingsRegistry::Register(
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/components/content_settings/core/browser/content_settings_registry.h b/components/content_settings/core/browser/content_settings_registry.h
index 14675088fd820177584f64ebf70bfed84009ccbe..95fee3d64377763af1fdd412583e8fe3b3c77a09 100644
--- a/components/content_settings/core/browser/content_settings_registry.h
+++ b/components/content_settings/core/browser/content_settings_registry.h
@@ -53,6 +53,7 @@ class ContentSettingsRegistry {
~ContentSettingsRegistry();

void Init();
+ void BraveInit();

typedef uint32_t Platforms;

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/components/content_settings/core/browser/website_settings_registry.h b/components/content_settings/core/browser/website_settings_registry.h
index f717f0c6ad479bfcc533f441f6e377963943525c..645a9cf52c2b1360b716e06da4e79b334ba8a8f4 100644
--- a/components/content_settings/core/browser/website_settings_registry.h
+++ b/components/content_settings/core/browser/website_settings_registry.h
@@ -75,6 +75,7 @@ class WebsiteSettingsRegistry {
WebsiteSettingsInfo::ScopingType scoping_type,
Platforms platforms,
WebsiteSettingsInfo::IncognitoBehavior incognito_behavior);
+ void UnRegister(ContentSettingsType type) {website_settings_info_.erase(type);}

const_iterator begin() const;
const_iterator end() const;

0 comments on commit a85e50e

Please sign in to comment.