| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SETTINGS_OVERRIDES_SETTINGS_OVERRIDES_API_
H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SETTINGS_OVERRIDES_SETTINGS_OVERRIDES_API_
H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SETTINGS_OVERRIDES_SETTINGS_OVERRIDES_API_
H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SETTINGS_OVERRIDES_SETTINGS_OVERRIDES_API_
H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/scoped_observer.h" | 11 #include "base/scoped_observer.h" |
| 12 #include "components/search_engines/template_url_service.h" | 12 #include "components/search_engines/template_url_service.h" |
| 13 #include "extensions/browser/browser_context_keyed_api_factory.h" | 13 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 14 #include "extensions/browser/extension_registry_observer.h" | 14 #include "extensions/browser/extension_registry_observer.h" |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 class TemplateURL; | 17 class TemplateURL; |
| 18 | 18 |
| 19 namespace extensions { | 19 namespace extensions { |
| 20 class ExtensionRegistry; | 20 class ExtensionRegistry; |
| 21 | 21 |
| 22 class SettingsOverridesAPI : public BrowserContextKeyedAPI, | 22 class SettingsOverridesAPI : public BrowserContextKeyedAPI, |
| 23 public ExtensionRegistryObserver { | 23 public ExtensionRegistryObserver { |
| 24 public: | 24 public: |
| 25 explicit SettingsOverridesAPI(content::BrowserContext* context); | 25 explicit SettingsOverridesAPI(content::BrowserContext* context); |
| 26 virtual ~SettingsOverridesAPI(); | 26 ~SettingsOverridesAPI() override; |
| 27 | 27 |
| 28 // BrowserContextKeyedAPI implementation. | 28 // BrowserContextKeyedAPI implementation. |
| 29 static BrowserContextKeyedAPIFactory<SettingsOverridesAPI>* | 29 static BrowserContextKeyedAPIFactory<SettingsOverridesAPI>* |
| 30 GetFactoryInstance(); | 30 GetFactoryInstance(); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 friend class BrowserContextKeyedAPIFactory<SettingsOverridesAPI>; | 33 friend class BrowserContextKeyedAPIFactory<SettingsOverridesAPI>; |
| 34 | 34 |
| 35 typedef std::set<scoped_refptr<const Extension> > PendingExtensions; | 35 typedef std::set<scoped_refptr<const Extension> > PendingExtensions; |
| 36 | 36 |
| 37 // Wrappers around PreferenceAPI. | 37 // Wrappers around PreferenceAPI. |
| 38 void SetPref(const std::string& extension_id, | 38 void SetPref(const std::string& extension_id, |
| 39 const std::string& pref_key, | 39 const std::string& pref_key, |
| 40 base::Value* value); | 40 base::Value* value); |
| 41 void UnsetPref(const std::string& extension_id, | 41 void UnsetPref(const std::string& extension_id, |
| 42 const std::string& pref_key); | 42 const std::string& pref_key); |
| 43 | 43 |
| 44 // ExtensionRegistryObserver implementation. | 44 // ExtensionRegistryObserver implementation. |
| 45 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, | 45 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 46 const Extension* extension) override; | 46 const Extension* extension) override; |
| 47 virtual void OnExtensionUnloaded( | 47 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 48 content::BrowserContext* browser_context, | 48 const Extension* extension, |
| 49 const Extension* extension, | 49 UnloadedExtensionInfo::Reason reason) override; |
| 50 UnloadedExtensionInfo::Reason reason) override; | |
| 51 | 50 |
| 52 // KeyedService implementation. | 51 // KeyedService implementation. |
| 53 virtual void Shutdown() override; | 52 void Shutdown() override; |
| 54 | 53 |
| 55 void OnTemplateURLsLoaded(); | 54 void OnTemplateURLsLoaded(); |
| 56 | 55 |
| 57 void RegisterSearchProvider(const Extension* extension) const; | 56 void RegisterSearchProvider(const Extension* extension) const; |
| 58 // BrowserContextKeyedAPI implementation. | 57 // BrowserContextKeyedAPI implementation. |
| 59 static const char* service_name() { return "SettingsOverridesAPI"; } | 58 static const char* service_name() { return "SettingsOverridesAPI"; } |
| 60 | 59 |
| 61 Profile* profile_; | 60 Profile* profile_; |
| 62 TemplateURLService* url_service_; | 61 TemplateURLService* url_service_; |
| 63 | 62 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 74 DISALLOW_COPY_AND_ASSIGN(SettingsOverridesAPI); | 73 DISALLOW_COPY_AND_ASSIGN(SettingsOverridesAPI); |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 template <> | 76 template <> |
| 78 void BrowserContextKeyedAPIFactory< | 77 void BrowserContextKeyedAPIFactory< |
| 79 SettingsOverridesAPI>::DeclareFactoryDependencies(); | 78 SettingsOverridesAPI>::DeclareFactoryDependencies(); |
| 80 | 79 |
| 81 } // namespace extensions | 80 } // namespace extensions |
| 82 | 81 |
| 83 #endif // CHROME_BROWSER_EXTENSIONS_API_SETTINGS_OVERRIDES_SETTINGS_OVERRIDES_A
PI_H_ | 82 #endif // CHROME_BROWSER_EXTENSIONS_API_SETTINGS_OVERRIDES_SETTINGS_OVERRIDES_A
PI_H_ |
| OLD | NEW |