summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/preference
diff options
context:
space:
mode:
authorlimasdf@gmail.com <limasdf@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-18 10:26:40 +0000
committerlimasdf@gmail.com <limasdf@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-18 10:26:40 +0000
commit9b44832024e41de8398265737601ab1992ffebc5 (patch)
tree6c9d0da9e58699ddfb3f0404b455493849874e5f /chrome/browser/extensions/api/preference
parent65d906a6ab188025db5809a3674b7965eaa07f12 (diff)
downloadchromium_src-9b44832024e41de8398265737601ab1992ffebc5.zip
chromium_src-9b44832024e41de8398265737601ab1992ffebc5.tar.gz
chromium_src-9b44832024e41de8398265737601ab1992ffebc5.tar.bz2
Use EventRouter instead of ExtensionSystem::Get->event_router()
all clean-up BUG=362672 Review URL: https://codereview.chromium.org/238633009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264765 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/preference')
-rw-r--r--chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc8
-rw-r--r--chrome/browser/extensions/api/preference/preference_api.cc8
-rw-r--r--chrome/browser/extensions/api/preference/preference_helpers.cc3
3 files changed, 7 insertions, 12 deletions
diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc
index d122cfe..c83f80f 100644
--- a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc
+++ b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc
@@ -42,9 +42,7 @@ class PreferenceWhitelist {
std::string event_name = base::StringPrintf(
kOnPrefChangeFormat,
(*iter).c_str());
- ExtensionSystem::Get(profile)->event_router()->RegisterObserver(
- observer,
- event_name);
+ EventRouter::Get(profile)->RegisterObserver(observer, event_name);
}
}
@@ -94,7 +92,7 @@ ChromeDirectSettingAPI::GetFactoryInstance() {
// EventRouter::Observer implementation.
void ChromeDirectSettingAPI::OnListenerAdded(const EventListenerInfo& details) {
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ EventRouter::Get(profile_)->UnregisterObserver(this);
registrar_.Init(profile_->GetPrefs());
preference_whitelist.Get().RegisterPropertyListeners(
profile_,
@@ -123,7 +121,7 @@ void ChromeDirectSettingAPI::OnPrefChanged(
PrefService* pref_service, const std::string& pref_key) {
std::string event_name = base::StringPrintf(kOnPrefChangeFormat,
pref_key.c_str());
- EventRouter* router = ExtensionSystem::Get(profile_)->event_router();
+ EventRouter* router = EventRouter::Get(profile_);
if (router && router->HasEventListener(event_name)) {
const PrefService::Preference* preference =
profile_->GetPrefs()->FindPreference(pref_key.c_str());
diff --git a/chrome/browser/extensions/api/preference/preference_api.cc b/chrome/browser/extensions/api/preference/preference_api.cc
index a964595..26a088f 100644
--- a/chrome/browser/extensions/api/preference/preference_api.cc
+++ b/chrome/browser/extensions/api/preference/preference_api.cc
@@ -27,7 +27,6 @@
#include "extensions/browser/extension_pref_value_map.h"
#include "extensions/browser/extension_pref_value_map_factory.h"
#include "extensions/browser/extension_prefs_factory.h"
-#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/pref_names.h"
@@ -413,8 +412,7 @@ PreferenceAPI::PreferenceAPI(content::BrowserContext* context)
bool rv = PrefMapping::GetInstance()->FindEventForBrowserPref(
kPrefMapping[i].browser_pref, &event_name, &permission);
DCHECK(rv);
- ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
- this, event_name);
+ EventRouter::Get(profile_)->RegisterObserver(this, event_name);
}
content_settings_store()->AddObserver(this);
}
@@ -423,7 +421,7 @@ PreferenceAPI::~PreferenceAPI() {
}
void PreferenceAPI::Shutdown() {
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ EventRouter::Get(profile_)->UnregisterObserver(this);
if (!extension_prefs()->extensions_disabled())
ClearIncognitoSessionOnlyContentSettings();
content_settings_store()->RemoveObserver(this);
@@ -445,7 +443,7 @@ PreferenceAPI* PreferenceAPI::Get(content::BrowserContext* context) {
void PreferenceAPI::OnListenerAdded(const EventListenerInfo& details) {
preference_event_router_.reset(new PreferenceEventRouter(profile_));
- ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
+ EventRouter::Get(profile_)->UnregisterObserver(this);
}
void PreferenceAPI::OnContentSettingChanged(const std::string& extension_id,
diff --git a/chrome/browser/extensions/api/preference/preference_helpers.cc b/chrome/browser/extensions/api/preference/preference_helpers.cc
index fe55fd7..09b00f3 100644
--- a/chrome/browser/extensions/api/preference/preference_helpers.cc
+++ b/chrome/browser/extensions/api/preference/preference_helpers.cc
@@ -89,8 +89,7 @@ void DispatchEventToExtensions(
APIPermission::ID permission,
bool incognito,
const std::string& browser_pref) {
- EventRouter* router =
- ExtensionSystem::Get(profile)->event_router();
+ EventRouter* router = EventRouter::Get(profile);
if (!router || !router->HasEventListener(event_name))
return;
ExtensionService* extension_service =