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 <stddef.h> | 7 #include <stddef.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 void SettingsOverridesAPI::OnExtensionLoaded( | 153 void SettingsOverridesAPI::OnExtensionLoaded( |
154 content::BrowserContext* browser_context, | 154 content::BrowserContext* browser_context, |
155 const Extension* extension) { | 155 const Extension* extension) { |
156 const SettingsOverrides* settings = SettingsOverrides::Get(extension); | 156 const SettingsOverrides* settings = SettingsOverrides::Get(extension); |
157 if (settings) { | 157 if (settings) { |
158 std::string install_parameter = | 158 std::string install_parameter = |
159 ExtensionPrefs::Get(profile_)->GetInstallParam(extension->id()); | 159 ExtensionPrefs::Get(profile_)->GetInstallParam(extension->id()); |
160 if (settings->homepage) { | 160 if (settings->homepage) { |
161 SetPref(extension->id(), prefs::kHomePage, | 161 SetPref(extension->id(), prefs::kHomePage, |
162 base::MakeUnique<base::StringValue>(SubstituteInstallParam( | 162 base::MakeUnique<base::Value>(SubstituteInstallParam( |
163 settings->homepage->spec(), install_parameter))); | 163 settings->homepage->spec(), install_parameter))); |
164 SetPref(extension->id(), prefs::kHomePageIsNewTabPage, | 164 SetPref(extension->id(), prefs::kHomePageIsNewTabPage, |
165 base::MakeUnique<base::Value>(false)); | 165 base::MakeUnique<base::Value>(false)); |
166 } | 166 } |
167 if (!settings->startup_pages.empty()) { | 167 if (!settings->startup_pages.empty()) { |
168 SetPref( | 168 SetPref( |
169 extension->id(), prefs::kRestoreOnStartup, | 169 extension->id(), prefs::kRestoreOnStartup, |
170 base::MakeUnique<base::Value>(SessionStartupPref::kPrefValueURLs)); | 170 base::MakeUnique<base::Value>(SessionStartupPref::kPrefValueURLs)); |
171 if (settings->startup_pages.size() > 1) { | 171 if (settings->startup_pages.size() > 1) { |
172 VLOG(1) << extensions::ErrorUtils::FormatErrorMessage( | 172 VLOG(1) << extensions::ErrorUtils::FormatErrorMessage( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 252 |
253 template <> | 253 template <> |
254 void BrowserContextKeyedAPIFactory< | 254 void BrowserContextKeyedAPIFactory< |
255 SettingsOverridesAPI>::DeclareFactoryDependencies() { | 255 SettingsOverridesAPI>::DeclareFactoryDependencies() { |
256 DependsOn(ExtensionPrefsFactory::GetInstance()); | 256 DependsOn(ExtensionPrefsFactory::GetInstance()); |
257 DependsOn(PreferenceAPI::GetFactoryInstance()); | 257 DependsOn(PreferenceAPI::GetFactoryInstance()); |
258 DependsOn(TemplateURLServiceFactory::GetInstance()); | 258 DependsOn(TemplateURLServiceFactory::GetInstance()); |
259 } | 259 } |
260 | 260 |
261 } // namespace extensions | 261 } // namespace extensions |
OLD | NEW |