Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Side by Side Diff: chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc

Issue 174513003: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 3). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/prefs/session_startup_pref.h" 11 #include "chrome/browser/prefs/session_startup_pref.h"
12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/search_engines/template_url.h" 13 #include "chrome/browser/search_engines/template_url.h"
13 #include "chrome/browser/search_engines/template_url_service_factory.h" 14 #include "chrome/browser/search_engines/template_url_service_factory.h"
14 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h" 15 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "content/public/browser/notification_details.h" 17 #include "content/public/browser/notification_details.h"
17 #include "content/public/browser/notification_source.h" 18 #include "content/public/browser/notification_source.h"
18 #include "extensions/browser/extension_prefs.h" 19 #include "extensions/browser/extension_prefs.h"
19 #include "extensions/browser/extension_prefs_factory.h" 20 #include "extensions/browser/extension_prefs_factory.h"
20 #include "extensions/common/error_utils.h" 21 #include "extensions/common/error_utils.h"
21 #include "extensions/common/manifest_constants.h" 22 #include "extensions/common/manifest_constants.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (search_provider.alternate_urls) { 63 if (search_provider.alternate_urls) {
63 for (size_t i = 0; i < search_provider.alternate_urls->size(); ++i) { 64 for (size_t i = 0; i < search_provider.alternate_urls->size(); ++i) {
64 if (!search_provider.alternate_urls->at(i).empty()) 65 if (!search_provider.alternate_urls->at(i).empty())
65 data.alternate_urls.push_back(search_provider.alternate_urls->at(i)); 66 data.alternate_urls.push_back(search_provider.alternate_urls->at(i));
66 } 67 }
67 } 68 }
68 return data; 69 return data;
69 } 70 }
70 } // namespace 71 } // namespace
71 72
72 SettingsOverridesAPI::SettingsOverridesAPI(Profile* profile) 73 SettingsOverridesAPI::SettingsOverridesAPI(content::BrowserContext* context)
73 : profile_(profile), 74 : profile_(Profile::FromBrowserContext(context)),
74 url_service_(TemplateURLServiceFactory::GetForProfile(profile)) { 75 url_service_(TemplateURLServiceFactory::GetForProfile(profile_)) {
75 DCHECK(profile); 76 DCHECK(profile_);
76 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 77 registrar_.Add(this,
77 content::Source<Profile>(profile)); 78 chrome::NOTIFICATION_EXTENSION_LOADED,
78 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 79 content::Source<Profile>(profile_));
79 content::Source<Profile>(profile)); 80 registrar_.Add(this,
81 chrome::NOTIFICATION_EXTENSION_UNLOADED,
82 content::Source<Profile>(profile_));
80 } 83 }
81 84
82 SettingsOverridesAPI::~SettingsOverridesAPI() { 85 SettingsOverridesAPI::~SettingsOverridesAPI() {
83 } 86 }
84 87
85 ProfileKeyedAPIFactory<SettingsOverridesAPI>* 88 ProfileKeyedAPIFactory<SettingsOverridesAPI>*
86 SettingsOverridesAPI::GetFactoryInstance() { 89 SettingsOverridesAPI::GetFactoryInstance() {
87 return g_factory.Pointer(); 90 return g_factory.Pointer();
88 } 91 }
89 92
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 222
220 template <> 223 template <>
221 void ProfileKeyedAPIFactory<SettingsOverridesAPI>:: 224 void ProfileKeyedAPIFactory<SettingsOverridesAPI>::
222 DeclareFactoryDependencies() { 225 DeclareFactoryDependencies() {
223 DependsOn(ExtensionPrefsFactory::GetInstance()); 226 DependsOn(ExtensionPrefsFactory::GetInstance());
224 DependsOn(PreferenceAPI::GetFactoryInstance()); 227 DependsOn(PreferenceAPI::GetFactoryInstance());
225 DependsOn(TemplateURLServiceFactory::GetInstance()); 228 DependsOn(TemplateURLServiceFactory::GetInstance());
226 } 229 }
227 230
228 } // namespace extensions 231 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698