| 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_INTERFACE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| 11 #include "chrome/common/extensions/manifest.h" | 11 #include "chrome/common/extensions/manifest.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 class Version; | |
| 15 | 14 |
| 16 namespace base { | 15 namespace base { |
| 17 class FilePath; | 16 class FilePath; |
| 17 class Version; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 | 21 |
| 22 // This class is an abstract class for implementing external extensions | 22 // This class is an abstract class for implementing external extensions |
| 23 // providers. | 23 // providers. |
| 24 class ExternalProviderInterface { | 24 class ExternalProviderInterface { |
| 25 public: | 25 public: |
| 26 // ExternalProvider uses this interface to communicate back to the | 26 // ExternalProvider uses this interface to communicate back to the |
| 27 // caller what extensions are registered, and which |id|, |version| and |path| | 27 // caller what extensions are registered, and which |id|, |version| and |path| |
| 28 // they have. See also VisitRegisteredExtension below. Ownership of |version| | 28 // they have. See also VisitRegisteredExtension below. Ownership of |version| |
| 29 // is not transferred to the visitor. Callers of the methods below must | 29 // is not transferred to the visitor. Callers of the methods below must |
| 30 // ensure that |id| is a valid extension id (use Extension::IdIsValid(id)). | 30 // ensure that |id| is a valid extension id (use Extension::IdIsValid(id)). |
| 31 class VisitorInterface { | 31 class VisitorInterface { |
| 32 public: | 32 public: |
| 33 // Return true if the extension install will proceed. Install will not | 33 // Return true if the extension install will proceed. Install will not |
| 34 // proceed if the extension is already installed from a higher priority | 34 // proceed if the extension is already installed from a higher priority |
| 35 // location. | 35 // location. |
| 36 virtual bool OnExternalExtensionFileFound( | 36 virtual bool OnExternalExtensionFileFound( |
| 37 const std::string& id, | 37 const std::string& id, |
| 38 const Version* version, | 38 const base::Version* version, |
| 39 const base::FilePath& path, | 39 const base::FilePath& path, |
| 40 Manifest::Location location, | 40 Manifest::Location location, |
| 41 int creation_flags, | 41 int creation_flags, |
| 42 bool mark_acknowledged) = 0; | 42 bool mark_acknowledged) = 0; |
| 43 | 43 |
| 44 // Return true if the extension install will proceed. Install might not | 44 // Return true if the extension install will proceed. Install might not |
| 45 // proceed if the extension is already installed from a higher priority | 45 // proceed if the extension is already installed from a higher priority |
| 46 // location. | 46 // location. |
| 47 virtual bool OnExternalExtensionUpdateUrlFound( | 47 virtual bool OnExternalExtensionUpdateUrlFound( |
| 48 const std::string& id, | 48 const std::string& id, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 71 // registered extension found. | 71 // registered extension found. |
| 72 virtual void VisitRegisteredExtension() = 0; | 72 virtual void VisitRegisteredExtension() = 0; |
| 73 | 73 |
| 74 // Test if this provider has an extension with id |id| registered. | 74 // Test if this provider has an extension with id |id| registered. |
| 75 virtual bool HasExtension(const std::string& id) const = 0; | 75 virtual bool HasExtension(const std::string& id) const = 0; |
| 76 | 76 |
| 77 // Gets details of an extension by its id. Output params will be set only | 77 // Gets details of an extension by its id. Output params will be set only |
| 78 // if they are not NULL. If an output parameter is not specified by the | 78 // if they are not NULL. If an output parameter is not specified by the |
| 79 // provider type, it will not be changed. | 79 // provider type, it will not be changed. |
| 80 // This function is no longer used outside unit tests. | 80 // This function is no longer used outside unit tests. |
| 81 virtual bool GetExtensionDetails(const std::string& id, | 81 virtual bool GetExtensionDetails( |
| 82 Manifest::Location* location, | 82 const std::string& id, |
| 83 scoped_ptr<Version>* version) const = 0; | 83 Manifest::Location* location, |
| 84 scoped_ptr<base::Version>* version) const = 0; |
| 84 | 85 |
| 85 // Determines if this provider had loaded the list of external extensions | 86 // Determines if this provider had loaded the list of external extensions |
| 86 // from its source. | 87 // from its source. |
| 87 virtual bool IsReady() const = 0; | 88 virtual bool IsReady() const = 0; |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 typedef std::vector<linked_ptr<ExternalProviderInterface> > | 91 typedef std::vector<linked_ptr<ExternalProviderInterface> > |
| 91 ProviderCollection; | 92 ProviderCollection; |
| 92 | 93 |
| 93 } // namespace extensions | 94 } // namespace extensions |
| 94 | 95 |
| 95 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_INTERFACE_H_ | 96 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_INTERFACE_H_ |
| OLD | NEW |