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

Side by Side Diff: chrome/browser/extensions/api/preference/preference_api.cc

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/preference/preference_api.h" 5 #include "chrome/browser/extensions/api/preference/preference_api.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 PreferenceAPI::~PreferenceAPI() { 393 PreferenceAPI::~PreferenceAPI() {
394 } 394 }
395 395
396 void PreferenceAPI::Shutdown() { 396 void PreferenceAPI::Shutdown() {
397 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 397 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
398 if (!extension_prefs()->extensions_disabled()) 398 if (!extension_prefs()->extensions_disabled())
399 ClearIncognitoSessionOnlyContentSettings(); 399 ClearIncognitoSessionOnlyContentSettings();
400 extension_prefs()->content_settings_store()->RemoveObserver(this); 400 extension_prefs()->content_settings_store()->RemoveObserver(this);
401 } 401 }
402 402
403 static base::LazyInstance<ProfileKeyedAPIFactory<PreferenceAPI> > 403 static base::LazyInstance<BrowserContextKeyedAPIFactory<PreferenceAPI> >
404 g_factory = LAZY_INSTANCE_INITIALIZER; 404 g_factory = LAZY_INSTANCE_INITIALIZER;
405 405
406 // static 406 // static
407 ProfileKeyedAPIFactory<PreferenceAPI>* PreferenceAPI::GetFactoryInstance() { 407 BrowserContextKeyedAPIFactory<PreferenceAPI>*
408 PreferenceAPI::GetFactoryInstance() {
408 return g_factory.Pointer(); 409 return g_factory.Pointer();
409 } 410 }
410 411
411 // static 412 // static
412 PreferenceAPI* PreferenceAPI::Get(content::BrowserContext* context) { 413 PreferenceAPI* PreferenceAPI::Get(content::BrowserContext* context) {
413 return ProfileKeyedAPIFactory<PreferenceAPI>::GetForProfile(context); 414 return BrowserContextKeyedAPIFactory<PreferenceAPI>::Get(context);
414 } 415 }
415 416
416 void PreferenceAPI::OnListenerAdded(const EventListenerInfo& details) { 417 void PreferenceAPI::OnListenerAdded(const EventListenerInfo& details) {
417 preference_event_router_.reset(new PreferenceEventRouter(profile_)); 418 preference_event_router_.reset(new PreferenceEventRouter(profile_));
418 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 419 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
419 } 420 }
420 421
421 // static 422 // static
422 void PreferenceAPI::LoadExtensionControlledPrefs( 423 void PreferenceAPI::LoadExtensionControlledPrefs(
423 ExtensionPrefs* prefs, 424 ExtensionPrefs* prefs,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 524
524 ExtensionPrefs* PreferenceAPI::extension_prefs() { 525 ExtensionPrefs* PreferenceAPI::extension_prefs() {
525 return ExtensionPrefs::Get(profile_); 526 return ExtensionPrefs::Get(profile_);
526 } 527 }
527 528
528 ExtensionPrefValueMap* PreferenceAPI::extension_pref_value_map() { 529 ExtensionPrefValueMap* PreferenceAPI::extension_pref_value_map() {
529 return ExtensionPrefValueMapFactory::GetForBrowserContext(profile_); 530 return ExtensionPrefValueMapFactory::GetForBrowserContext(profile_);
530 } 531 }
531 532
532 template <> 533 template <>
533 void ProfileKeyedAPIFactory<PreferenceAPI>::DeclareFactoryDependencies() { 534 void
535 BrowserContextKeyedAPIFactory<PreferenceAPI>::DeclareFactoryDependencies() {
534 DependsOn(ExtensionPrefsFactory::GetInstance()); 536 DependsOn(ExtensionPrefsFactory::GetInstance());
535 DependsOn(ExtensionPrefValueMapFactory::GetInstance()); 537 DependsOn(ExtensionPrefValueMapFactory::GetInstance());
536 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); 538 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
537 } 539 }
538 540
539 PreferenceFunction::~PreferenceFunction() { } 541 PreferenceFunction::~PreferenceFunction() { }
540 542
541 bool PreferenceFunction::ValidateBrowserPref( 543 bool PreferenceFunction::ValidateBrowserPref(
542 const std::string& extension_pref_key, 544 const std::string& extension_pref_key,
543 std::string* browser_pref_key) { 545 std::string* browser_pref_key) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 std::string browser_pref; 735 std::string browser_pref;
734 if (!ValidateBrowserPref(pref_key, &browser_pref)) 736 if (!ValidateBrowserPref(pref_key, &browser_pref))
735 return false; 737 return false;
736 738
737 PreferenceAPI::Get(GetProfile()) 739 PreferenceAPI::Get(GetProfile())
738 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); 740 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope);
739 return true; 741 return true;
740 } 742 }
741 743
742 } // namespace extensions 744 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/preference/preference_api.h ('k') | chrome/browser/extensions/api/processes/processes_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698