summaryrefslogtreecommitdiffstats
path: root/chrome/browser/custom_handlers
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-22 17:24:44 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-22 17:24:44 +0000
commit5b19952e27008d9cca170c1a517987795d145928 (patch)
tree34fea6a6f74a0388c68c4ba8cd8846f3ac879027 /chrome/browser/custom_handlers
parent96828ec57f67f91b3b1b2269963680501a6de4b9 (diff)
downloadchromium_src-5b19952e27008d9cca170c1a517987795d145928.zip
chromium_src-5b19952e27008d9cca170c1a517987795d145928.tar.gz
chromium_src-5b19952e27008d9cca170c1a517987795d145928.tar.bz2
Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable.
The first two (PrefServiceSimple is a subclass of PrefService) know nothing about sync or any Chrome or content concepts. The third (PrefServiceSyncable, a separate subclass of PrefService) knows about sync and requires users to choose whether each individual preference is syncable or not when it is registered. BrowserProcess::local_state() is a PrefServiceSimple after this change, and Profile::prefs() is a PrefServiceSyncable. COLLABORATOR=kaiwang@chromium.org TBR=ben@chromium.org BUG=155525 Review URL: https://chromiumcodereview.appspot.com/11570009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/custom_handlers')
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry.cc9
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry.h4
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc11
3 files changed, 16 insertions, 8 deletions
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index a95fd1c..bab8c44 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -708,13 +708,14 @@ void ProtocolHandlerRegistry::Shutdown() {
}
// static
-void ProtocolHandlerRegistry::RegisterPrefs(PrefService* pref_service) {
+void ProtocolHandlerRegistry::RegisterUserPrefs(
+ PrefServiceSyncable* pref_service) {
pref_service->RegisterListPref(prefs::kRegisteredProtocolHandlers,
- PrefService::UNSYNCABLE_PREF);
+ PrefServiceSyncable::UNSYNCABLE_PREF);
pref_service->RegisterListPref(prefs::kIgnoredProtocolHandlers,
- PrefService::UNSYNCABLE_PREF);
+ PrefServiceSyncable::UNSYNCABLE_PREF);
pref_service->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true,
- PrefService::UNSYNCABLE_PREF);
+ PrefServiceSyncable::UNSYNCABLE_PREF);
}
ProtocolHandlerRegistry::~ProtocolHandlerRegistry() {
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.h b/chrome/browser/custom_handlers/protocol_handler_registry.h
index 25de955..e8ae913 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.h
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.h
@@ -22,6 +22,8 @@
#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_job_factory.h"
+class PrefServiceSyncable;
+
// This is where handlers for protocols registered with
// navigator.registerProtocolHandler() are registered. Each Profile owns an
// instance of this class, which is initialized on browser start through
@@ -191,7 +193,7 @@ class ProtocolHandlerRegistry : public ProfileKeyedService {
virtual void Shutdown() OVERRIDE;
// Registers the preferences that we store registered protocol handlers in.
- static void RegisterPrefs(PrefService* prefService);
+ static void RegisterUserPrefs(PrefServiceSyncable* prefService);
bool enabled() const { return enabled_; }
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index 0c89013..1561a14 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -279,7 +279,9 @@ class ProtocolHandlerRegistryTest : public testing::Test {
FakeDelegate* delegate() const { return delegate_; }
ProtocolHandlerRegistry* registry() { return registry_.get(); }
TestingProfile* profile() const { return profile_.get(); }
- PrefService* pref_service() const { return profile_->GetPrefs(); }
+ // TODO(joi): Check if this can be removed, as well as the call to
+ // SetPrefService in SetUp.
+ PrefServiceSyncable* pref_service() const { return profile_->GetPrefs(); }
const ProtocolHandler& test_protocol_handler() const {
return test_protocol_handler_;
}
@@ -318,11 +320,14 @@ class ProtocolHandlerRegistryTest : public testing::Test {
virtual void SetUp() {
profile_.reset(new TestingProfile());
- profile_->SetPrefService(new TestingPrefService());
+ profile_->SetPrefService(new TestingPrefServiceSyncable());
SetUpRegistry(true);
test_protocol_handler_ =
CreateProtocolHandler("test", GURL("http://test.com/%s"), "Test");
- ProtocolHandlerRegistry::RegisterPrefs(pref_service());
+
+ // TODO(joi): If pref_service() and the SetPrefService above go,
+ // then this could go.
+ ProtocolHandlerRegistry::RegisterUserPrefs(pref_service());
}
virtual void TearDown() {