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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 PreferenceAPI::~PreferenceAPI() { | 510 PreferenceAPI::~PreferenceAPI() { |
511 } | 511 } |
512 | 512 |
513 void PreferenceAPI::Shutdown() { | 513 void PreferenceAPI::Shutdown() { |
514 EventRouter::Get(profile_)->UnregisterObserver(this); | 514 EventRouter::Get(profile_)->UnregisterObserver(this); |
515 if (!extension_prefs()->extensions_disabled()) | 515 if (!extension_prefs()->extensions_disabled()) |
516 ClearIncognitoSessionOnlyContentSettings(); | 516 ClearIncognitoSessionOnlyContentSettings(); |
517 content_settings_store()->RemoveObserver(this); | 517 content_settings_store()->RemoveObserver(this); |
518 } | 518 } |
519 | 519 |
520 static base::LazyInstance<BrowserContextKeyedAPIFactory<PreferenceAPI> > | 520 static base::LazyInstance< |
521 g_factory = LAZY_INSTANCE_INITIALIZER; | 521 BrowserContextKeyedAPIFactory<PreferenceAPI>>::DestructorAtExit g_factory = |
| 522 LAZY_INSTANCE_INITIALIZER; |
522 | 523 |
523 // static | 524 // static |
524 BrowserContextKeyedAPIFactory<PreferenceAPI>* | 525 BrowserContextKeyedAPIFactory<PreferenceAPI>* |
525 PreferenceAPI::GetFactoryInstance() { | 526 PreferenceAPI::GetFactoryInstance() { |
526 return g_factory.Pointer(); | 527 return g_factory.Pointer(); |
527 } | 528 } |
528 | 529 |
529 // static | 530 // static |
530 PreferenceAPI* PreferenceAPI::Get(content::BrowserContext* context) { | 531 PreferenceAPI* PreferenceAPI::Get(content::BrowserContext* context) { |
531 return BrowserContextKeyedAPIFactory<PreferenceAPI>::Get(context); | 532 return BrowserContextKeyedAPIFactory<PreferenceAPI>::Get(context); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 pref_key, &browser_pref, &read_permission, &write_permission)); | 773 pref_key, &browser_pref, &read_permission, &write_permission)); |
773 if (!extension()->permissions_data()->HasAPIPermission(write_permission)) | 774 if (!extension()->permissions_data()->HasAPIPermission(write_permission)) |
774 return RespondNow(Error(keys::kPermissionErrorMessage, pref_key)); | 775 return RespondNow(Error(keys::kPermissionErrorMessage, pref_key)); |
775 | 776 |
776 PreferenceAPI::Get(browser_context()) | 777 PreferenceAPI::Get(browser_context()) |
777 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); | 778 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); |
778 return RespondNow(NoArguments()); | 779 return RespondNow(NoArguments()); |
779 } | 780 } |
780 | 781 |
781 } // namespace extensions | 782 } // namespace extensions |
OLD | NEW |