OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | |
10 #include <string> | |
11 | |
12 #include "chrome/browser/extensions/external_extension_provider.h" | 9 #include "chrome/browser/extensions/external_extension_provider.h" |
13 | 10 |
14 class DictionaryValue; | 11 class DictionaryValue; |
15 class ValueSerializer; | 12 class ValueSerializer; |
16 class Version; | 13 class Version; |
17 | 14 |
18 // A specialization of the ExternalExtensionProvider that stores the registered | 15 // A specialization of the ExternalExtensionProvider that stores the registered |
19 // external extensions in a dictionary. This dictionary (|prefs_|) will be used | 16 // external extensions in a dictionary. This dictionary (|prefs_|) will be used |
20 // by HasExtension() and GetExtensionDetails() to return information about the | 17 // by HasExtension() and GetExtensionDetails() to return information about the |
21 // stored external extensions. It is the responsibility of specialized | 18 // stored external extensions. It is the responsibility of specialized |
22 // subclasses to initialize this internal dictionary. | 19 // subclasses to initialize this internal dictionary. |
23 // This provider can provide external extensions from two sources: crx files | 20 // This provider can provide external extensions from two sources: crx files |
24 // and udpate URLs. The locations that the provider will report for these | 21 // and udpate URLs. The locations that the provider will report for these |
25 // are specified at the constructor. | 22 // are specified at the constructor. |
26 class StatefulExternalExtensionProvider : public ExternalExtensionProvider { | 23 class StatefulExternalExtensionProvider : public ExternalExtensionProvider { |
27 public: | 24 public: |
28 // Initialize the location for external extensions originating from crx | 25 // Initialize the location for external extensions originating from crx |
29 // files: |crx_location|, and originating from update URLs: | 26 // files: |crx_location|, and originating from update URLs: |
30 // |download_location|. If either of the origins is not supported by this | 27 // |download_location|. If either of the origins is not supported by this |
31 // provider, then it should be initialized as Extensions::INVALID. | 28 // provider, then it should be initialized as Extensions::INVALID. |
32 StatefulExternalExtensionProvider( | 29 StatefulExternalExtensionProvider( |
33 Extension::Location crx_location, | 30 Extension::Location crx_location, |
34 Extension::Location download_location); | 31 Extension::Location download_location); |
35 virtual ~StatefulExternalExtensionProvider(); | 32 virtual ~StatefulExternalExtensionProvider(); |
36 | 33 |
37 // ExternalExtensionProvider implementation: | 34 // ExternalExtensionProvider implementation: |
38 virtual void VisitRegisteredExtension( | 35 virtual void VisitRegisteredExtension(Visitor* visitor) const; |
39 Visitor* visitor, const std::set<std::string>& ids_to_ignore) const; | |
40 | 36 |
41 virtual bool HasExtension(const std::string& id) const; | 37 virtual bool HasExtension(const std::string& id) const; |
42 | 38 |
43 virtual bool GetExtensionDetails(const std::string& id, | 39 virtual bool GetExtensionDetails(const std::string& id, |
44 Extension::Location* location, | 40 Extension::Location* location, |
45 scoped_ptr<Version>* version) const; | 41 scoped_ptr<Version>* version) const; |
46 protected: | 42 protected: |
47 // Location for external extensions that are provided by this provider from | 43 // Location for external extensions that are provided by this provider from |
48 // local crx files. | 44 // local crx files. |
49 const Extension::Location crx_location_; | 45 const Extension::Location crx_location_; |
50 // Location for external extensions that are provided by this provider from | 46 // Location for external extensions that are provided by this provider from |
51 // update URLs. | 47 // update URLs. |
52 const Extension::Location download_location_; | 48 const Extension::Location download_location_; |
53 // Dictionary of the external extensions that are provided by this provider. | 49 // Dictionary of the external extensions that are provided by this provider. |
54 scoped_ptr<DictionaryValue> prefs_; | 50 scoped_ptr<DictionaryValue> prefs_; |
55 }; | 51 }; |
56 | 52 |
57 #endif // CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ | 53 #endif // CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ |
OLD | NEW |