OLD | NEW |
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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 if (!extension_prefs()->extensions_disabled()) | 394 if (!extension_prefs()->extensions_disabled()) |
395 ClearIncognitoSessionOnlyContentSettings(); | 395 ClearIncognitoSessionOnlyContentSettings(); |
396 extension_prefs()->content_settings_store()->RemoveObserver(this); | 396 extension_prefs()->content_settings_store()->RemoveObserver(this); |
397 } | 397 } |
398 | 398 |
399 static base::LazyInstance<ProfileKeyedAPIFactory<PreferenceAPI> > | 399 static base::LazyInstance<ProfileKeyedAPIFactory<PreferenceAPI> > |
400 g_factory = LAZY_INSTANCE_INITIALIZER; | 400 g_factory = LAZY_INSTANCE_INITIALIZER; |
401 | 401 |
402 // static | 402 // static |
403 ProfileKeyedAPIFactory<PreferenceAPI>* PreferenceAPI::GetFactoryInstance() { | 403 ProfileKeyedAPIFactory<PreferenceAPI>* PreferenceAPI::GetFactoryInstance() { |
404 return &g_factory.Get(); | 404 return g_factory.Pointer(); |
405 } | 405 } |
406 | 406 |
407 // static | 407 // static |
408 PreferenceAPI* PreferenceAPI::Get(Profile* profile) { | 408 PreferenceAPI* PreferenceAPI::Get(Profile* profile) { |
409 return ProfileKeyedAPIFactory<PreferenceAPI>::GetForProfile(profile); | 409 return ProfileKeyedAPIFactory<PreferenceAPI>::GetForProfile(profile); |
410 } | 410 } |
411 | 411 |
412 void PreferenceAPI::OnListenerAdded(const EventListenerInfo& details) { | 412 void PreferenceAPI::OnListenerAdded(const EventListenerInfo& details) { |
413 preference_event_router_.reset(new PreferenceEventRouter(profile_)); | 413 preference_event_router_.reset(new PreferenceEventRouter(profile_)); |
414 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 414 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 std::string browser_pref; | 729 std::string browser_pref; |
730 if (!ValidateBrowserPref(pref_key, &browser_pref)) | 730 if (!ValidateBrowserPref(pref_key, &browser_pref)) |
731 return false; | 731 return false; |
732 | 732 |
733 PreferenceAPI::Get(GetProfile()) | 733 PreferenceAPI::Get(GetProfile()) |
734 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); | 734 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); |
735 return true; | 735 return true; |
736 } | 736 } |
737 | 737 |
738 } // namespace extensions | 738 } // namespace extensions |
OLD | NEW |