| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/settings_overrides/settings_overrides_ap
i.h" | 5 #include "chrome/browser/extensions/api/settings_overrides/settings_overrides_ap
i.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/api/preference/preference_api.h" | 10 #include "chrome/browser/extensions/api/preference/preference_api.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return data; | 85 return data; |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 SettingsOverridesAPI::SettingsOverridesAPI(content::BrowserContext* context) | 90 SettingsOverridesAPI::SettingsOverridesAPI(content::BrowserContext* context) |
| 91 : profile_(Profile::FromBrowserContext(context)), | 91 : profile_(Profile::FromBrowserContext(context)), |
| 92 url_service_(TemplateURLServiceFactory::GetForProfile(profile_)) { | 92 url_service_(TemplateURLServiceFactory::GetForProfile(profile_)) { |
| 93 DCHECK(profile_); | 93 DCHECK(profile_); |
| 94 registrar_.Add(this, | 94 registrar_.Add(this, |
| 95 chrome::NOTIFICATION_EXTENSION_LOADED, | 95 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 96 content::Source<Profile>(profile_)); | 96 content::Source<Profile>(profile_)); |
| 97 registrar_.Add(this, | 97 registrar_.Add(this, |
| 98 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 98 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 99 content::Source<Profile>(profile_)); | 99 content::Source<Profile>(profile_)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 SettingsOverridesAPI::~SettingsOverridesAPI() { | 102 SettingsOverridesAPI::~SettingsOverridesAPI() { |
| 103 } | 103 } |
| 104 | 104 |
| 105 BrowserContextKeyedAPIFactory<SettingsOverridesAPI>* | 105 BrowserContextKeyedAPIFactory<SettingsOverridesAPI>* |
| (...skipping 22 matching lines...) Expand all Loading... |
| 128 extension_id, | 128 extension_id, |
| 129 pref_key, | 129 pref_key, |
| 130 kExtensionPrefsScopeRegular); | 130 kExtensionPrefsScopeRegular); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void SettingsOverridesAPI::Observe( | 133 void SettingsOverridesAPI::Observe( |
| 134 int type, | 134 int type, |
| 135 const content::NotificationSource& source, | 135 const content::NotificationSource& source, |
| 136 const content::NotificationDetails& details) { | 136 const content::NotificationDetails& details) { |
| 137 switch (type) { | 137 switch (type) { |
| 138 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 138 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| 139 const Extension* extension = | 139 const Extension* extension = |
| 140 content::Details<const Extension>(details).ptr(); | 140 content::Details<const Extension>(details).ptr(); |
| 141 const SettingsOverrides* settings = | 141 const SettingsOverrides* settings = |
| 142 SettingsOverrides::Get(extension); | 142 SettingsOverrides::Get(extension); |
| 143 if (settings) { | 143 if (settings) { |
| 144 std::string install_parameter = | 144 std::string install_parameter = |
| 145 ExtensionPrefs::Get(profile_)->GetInstallParam(extension->id()); | 145 ExtensionPrefs::Get(profile_)->GetInstallParam(extension->id()); |
| 146 if (settings->homepage) { | 146 if (settings->homepage) { |
| 147 SetPref(extension->id(), | 147 SetPref(extension->id(), |
| 148 prefs::kHomePage, | 148 prefs::kHomePage, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 template <> | 258 template <> |
| 259 void BrowserContextKeyedAPIFactory< | 259 void BrowserContextKeyedAPIFactory< |
| 260 SettingsOverridesAPI>::DeclareFactoryDependencies() { | 260 SettingsOverridesAPI>::DeclareFactoryDependencies() { |
| 261 DependsOn(ExtensionPrefsFactory::GetInstance()); | 261 DependsOn(ExtensionPrefsFactory::GetInstance()); |
| 262 DependsOn(PreferenceAPI::GetFactoryInstance()); | 262 DependsOn(PreferenceAPI::GetFactoryInstance()); |
| 263 DependsOn(TemplateURLServiceFactory::GetInstance()); | 263 DependsOn(TemplateURLServiceFactory::GetInstance()); |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace extensions | 266 } // namespace extensions |
| OLD | NEW |