diff --git a/browser/extensions/BUILD.gn b/browser/extensions/BUILD.gn index 44c12270f7b6..81663f8f7e9a 100644 --- a/browser/extensions/BUILD.gn +++ b/browser/extensions/BUILD.gn @@ -4,8 +4,6 @@ source_set("extensions") { sources = [ "api/brave_shields_api.cc", "api/brave_shields_api.h", - "api/content_settings/brave_content_settings_store.cc", - "api/content_settings/brave_content_settings_store.h", "api/settings_private/brave_prefs_util.cc", "api/settings_private/brave_prefs_util.h", "brave_component_extension.cc", diff --git a/browser/extensions/api/content_settings/brave_content_settings_store.cc b/browser/extensions/api/content_settings/brave_content_settings_store.cc deleted file mode 100644 index 98b60200a3a4..000000000000 --- a/browser/extensions/api/content_settings/brave_content_settings_store.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "brave/browser/extensions/api/content_settings/brave_content_settings_store.h" - -namespace extensions { - -BraveContentSettingsStore::BraveContentSettingsStore() - : suppress_notifications_(false) { -} - -BraveContentSettingsStore::~BraveContentSettingsStore() { -} - -void BraveContentSettingsStore::SetExtensionContentSettingFromList( - const std::string& extension_id, - const base::ListValue* list, - ExtensionPrefsScope scope) { - if (list->GetList().empty()) return; - - // For SetExtensionContentSettingFromList use case, we delay the notification - // after the values in the list from extension_prefs are all stored in the - // content setting store. The delay of notification is needed because the - // values saved in extension_prefs will be overwritten by the one saved in - // content setting store in PreferenceAPI::OnContentSettingChanged. Without - // the delay, only the first entry in the list could be saved into content - // setting store. - suppress_notifications_ = true; - ContentSettingsStore::SetExtensionContentSettingFromList( - extension_id, list, scope); - suppress_notifications_ = false; - - // Send a single notification for the entire list. - NotifyOfContentSettingChanged(extension_id, - scope != kExtensionPrefsScopeRegular); -} - -void BraveContentSettingsStore::NotifyOfContentSettingChanged( - const std::string& extension_id, - bool incognito) { - if (suppress_notifications_) return; - ContentSettingsStore::NotifyOfContentSettingChanged(extension_id, incognito); -} - -} // namespace extensions diff --git a/browser/extensions/api/content_settings/brave_content_settings_store.h b/browser/extensions/api/content_settings/brave_content_settings_store.h deleted file mode 100644 index ecfab54711b8..000000000000 --- a/browser/extensions/api/content_settings/brave_content_settings_store.h +++ /dev/null @@ -1,39 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_BROWSER_EXTENSIONS_API_BREVE_CONTENT_SETTINGS_CONTENT_SETTINGS_STORE_H_ -#define BRAVE_BROWSER_EXTENSIONS_API_BREVE_CONTENT_SETTINGS_CONTENT_SETTINGS_STORE_H_ - -#include "chrome/browser/extensions/api/content_settings/content_settings_store.h" - -namespace extensions { - -// This class is the backend for extension-defined content settings. It is used -// by the content_settings::CustomExtensionProvider to integrate its settings -// into the HostContentSettingsMap and by the content settings extension API to -// provide extensions with access to content settings. -class BraveContentSettingsStore : public ContentSettingsStore { - public: - BraveContentSettingsStore(); - - // Deserializes content settings rules from |list| and applies them as set by - // the extension with ID |extension_id|. - void SetExtensionContentSettingFromList(const std::string& extension_id, - const base::ListValue* list, - ExtensionPrefsScope scope) override; - - void NotifyOfContentSettingChanged(const std::string& extension_id, - bool incognito) override; - private: - friend class base::RefCountedThreadSafe; - ~BraveContentSettingsStore() override; - - bool suppress_notifications_; - - DISALLOW_COPY_AND_ASSIGN(BraveContentSettingsStore); -}; - -} // namespace extensions - -#endif // BRAVE_BROWSER_EXTENSIONS_API_BREVE_CONTENT_SETTINGS_CONTENT_SETTINGS_STORE_H_ diff --git a/chromium_src/chrome/browser/extensions/api/content_settings/content_settings_service.cc b/chromium_src/chrome/browser/extensions/api/content_settings/content_settings_service.cc deleted file mode 100644 index 615d145195bf..000000000000 --- a/chromium_src/chrome/browser/extensions/api/content_settings/content_settings_service.cc +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "brave/browser/extensions/api/content_settings/brave_content_settings_store.h" - -#define ContentSettingsStore BraveContentSettingsStore -#include "../../../../../../../chrome/browser/extensions/api/content_settings/content_settings_service.cc" -#undef ContentSettingsStore diff --git a/patches/chrome-browser-extensions-api-content_settings-content_settings_store.h.patch b/patches/chrome-browser-extensions-api-content_settings-content_settings_store.h.patch deleted file mode 100644 index d308bc3bb1af..000000000000 --- a/patches/chrome-browser-extensions-api-content_settings-content_settings_store.h.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store.h b/chrome/browser/extensions/api/content_settings/content_settings_store.h -index ea311c4b725153133b79e653339b3a822857fff0..6930c297b296893b97ea09713db3f1238bafebeb 100644 ---- a/chrome/browser/extensions/api/content_settings/content_settings_store.h -+++ b/chrome/browser/extensions/api/content_settings/content_settings_store.h -@@ -86,7 +86,7 @@ class ContentSettingsStore - - // Deserializes content settings rules from |list| and applies them as set by - // the extension with ID |extension_id|. -- void SetExtensionContentSettingFromList(const std::string& extension_id, -+ virtual void SetExtensionContentSettingFromList(const std::string& extension_id, - const base::ListValue* list, - ExtensionPrefsScope scope); - -@@ -111,6 +111,7 @@ class ContentSettingsStore - void RemoveObserver(Observer* observer); - - private: -+ friend class BraveContentSettingsStore; - friend class base::RefCountedThreadSafe; - - struct ExtensionEntry; -@@ -129,7 +130,7 @@ class ContentSettingsStore - const std::string& ext_id, - ExtensionPrefsScope scope) const; - -- void NotifyOfContentSettingChanged(const std::string& extension_id, -+ virtual void NotifyOfContentSettingChanged(const std::string& extension_id, - bool incognito); - - bool OnCorrectThread();