OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/extensions/external_extension_provider_interface.h" | 9 #include "chrome/browser/extensions/external_extension_provider_interface.h" |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "chrome/browser/extensions/external_extension_loader.h" | 12 #include "chrome/browser/extensions/external_extension_loader.h" |
13 | 13 |
14 class DictionaryValue; | |
15 class ExternalExtensionLoader; | 14 class ExternalExtensionLoader; |
16 class Profile; | 15 class Profile; |
| 16 class Version; |
| 17 |
| 18 namespace base { |
| 19 class DictionaryValue; |
17 class ValueSerializer; | 20 class ValueSerializer; |
18 class Version; | 21 } |
19 | 22 |
20 // A specialization of the ExternalExtensionProvider that uses an instance | 23 // A specialization of the ExternalExtensionProvider that uses an instance |
21 // of ExternalExtensionLoader to provide external extensions. This class | 24 // of ExternalExtensionLoader to provide external extensions. This class |
22 // can be seen as a bridge between the extension system and an | 25 // can be seen as a bridge between the extension system and an |
23 // ExternalExtensionLoader. Instances live their entire life on the UI thread. | 26 // ExternalExtensionLoader. Instances live their entire life on the UI thread. |
24 class ExternalExtensionProviderImpl | 27 class ExternalExtensionProviderImpl |
25 : public ExternalExtensionProviderInterface { | 28 : public ExternalExtensionProviderInterface { |
26 public: | 29 public: |
27 // The constructed provider will provide the extensions loaded from |loader| | 30 // The constructed provider will provide the extensions loaded from |loader| |
28 // to |service|, that will deal with the installation. The location | 31 // to |service|, that will deal with the installation. The location |
(...skipping 11 matching lines...) Expand all Loading... |
40 virtual ~ExternalExtensionProviderImpl(); | 43 virtual ~ExternalExtensionProviderImpl(); |
41 | 44 |
42 // Populates a list with providers for all known sources. | 45 // Populates a list with providers for all known sources. |
43 static void CreateExternalProviders( | 46 static void CreateExternalProviders( |
44 VisitorInterface* service, | 47 VisitorInterface* service, |
45 Profile* profile, | 48 Profile* profile, |
46 ProviderCollection* provider_list); | 49 ProviderCollection* provider_list); |
47 | 50 |
48 // Sets underlying prefs and notifies provider. Only to be called by the | 51 // Sets underlying prefs and notifies provider. Only to be called by the |
49 // owned ExternalExtensionLoader instance. | 52 // owned ExternalExtensionLoader instance. |
50 void SetPrefs(DictionaryValue* prefs); | 53 void SetPrefs(base::DictionaryValue* prefs); |
51 | 54 |
52 // ExternalExtensionProvider implementation: | 55 // ExternalExtensionProvider implementation: |
53 virtual void VisitRegisteredExtension() const; | 56 virtual void VisitRegisteredExtension() const; |
54 | 57 |
55 virtual bool HasExtension(const std::string& id) const; | 58 virtual bool HasExtension(const std::string& id) const; |
56 | 59 |
57 virtual bool GetExtensionDetails(const std::string& id, | 60 virtual bool GetExtensionDetails(const std::string& id, |
58 Extension::Location* location, | 61 Extension::Location* location, |
59 scoped_ptr<Version>* version) const; | 62 scoped_ptr<Version>* version) const; |
60 | 63 |
(...skipping 15 matching lines...) Expand all Loading... |
76 // Location for external extensions that are provided by this provider from | 79 // Location for external extensions that are provided by this provider from |
77 // update URLs. | 80 // update URLs. |
78 const Extension::Location download_location_; | 81 const Extension::Location download_location_; |
79 | 82 |
80 private: | 83 private: |
81 // Weak pointer to the object that consumes the external extensions. | 84 // Weak pointer to the object that consumes the external extensions. |
82 // This is zeroed out by: ServiceShutdown() | 85 // This is zeroed out by: ServiceShutdown() |
83 VisitorInterface* service_; // weak | 86 VisitorInterface* service_; // weak |
84 | 87 |
85 // Dictionary of the external extensions that are provided by this provider. | 88 // Dictionary of the external extensions that are provided by this provider. |
86 scoped_ptr<DictionaryValue> prefs_; | 89 scoped_ptr<base::DictionaryValue> prefs_; |
87 | 90 |
88 // Indicates that the extensions provided by this provider are loaded | 91 // Indicates that the extensions provided by this provider are loaded |
89 // entirely. | 92 // entirely. |
90 bool ready_; | 93 bool ready_; |
91 | 94 |
92 // The loader that loads the list of external extensions and reports them | 95 // The loader that loads the list of external extensions and reports them |
93 // via |SetPrefs|. | 96 // via |SetPrefs|. |
94 scoped_refptr<ExternalExtensionLoader> loader_; | 97 scoped_refptr<ExternalExtensionLoader> loader_; |
95 | 98 |
96 DISALLOW_COPY_AND_ASSIGN(ExternalExtensionProviderImpl); | 99 DISALLOW_COPY_AND_ASSIGN(ExternalExtensionProviderImpl); |
97 }; | 100 }; |
98 | 101 |
99 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_ | 102 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_ |
OLD | NEW |