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