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_EXTERNAL_EXTENSION_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/version.h" | 11 #include "base/version.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 | 13 |
14 class FilePath; | 14 class FilePath; |
15 | 15 |
16 // This class is an abstract class for implementing external extensions | 16 // This class is an abstract class for implementing external extensions |
17 // providers. | 17 // providers. |
18 class ExternalExtensionProvider { | 18 class ExternalExtensionProvider { |
19 public: | 19 public: |
20 // ExternalExtensionProvider uses this interface to communicate back to the | 20 // ExternalExtensionProvider uses this interface to communicate back to the |
21 // caller what extensions are registered, and which |id|, |version| and |path| | 21 // caller what extensions are registered, and which |id|, |version| and |path| |
22 // they have. See also VisitRegisteredExtension below. Ownership of |version| | 22 // they have. See also VisitRegisteredExtension below. Ownership of |version| |
23 // is not transferred to the visitor. | 23 // is not transferred to the visitor. |
24 class Visitor { | 24 class Visitor { |
25 public: | 25 public: |
26 virtual void OnExternalExtensionFound(const std::string& id, | 26 virtual void OnExternalExtensionFound(const std::string& id, |
27 const Version* version, | 27 const Version* version, |
28 const FilePath& path) = 0; | 28 const FilePath& path, |
| 29 Extension::Location location) = 0; |
29 }; | 30 }; |
30 | 31 |
31 virtual ~ExternalExtensionProvider() {} | 32 virtual ~ExternalExtensionProvider() {} |
32 | 33 |
33 // Enumerate registered extension, calling OnExternalExtensionFound on | 34 // Enumerate registered extension, calling OnExternalExtensionFound on |
34 // the |visitor| object for each registered extension found. |ids_to_ignore| | 35 // the |visitor| object for each registered extension found. |ids_to_ignore| |
35 // contains a list of extension ids that should not result in a call back. | 36 // contains a list of extension ids that should not result in a call back. |
36 virtual void VisitRegisteredExtension( | 37 virtual void VisitRegisteredExtension( |
37 Visitor* visitor, const std::set<std::string>& ids_to_ignore) const = 0; | 38 Visitor* visitor, const std::set<std::string>& ids_to_ignore) const = 0; |
38 | 39 |
39 // Gets the version of extension with |id| and its |location|. |location| can | 40 // Gets the version of extension with |id| and its |location|. |location| can |
40 // be NULL. The caller is responsible for cleaning up the Version object | 41 // be NULL. The caller is responsible for cleaning up the Version object |
41 // returned. This function returns NULL if the extension is not found. | 42 // returned. This function returns NULL if the extension is not found. |
42 virtual Version* RegisteredVersion(const std::string& id, | 43 virtual Version* RegisteredVersion(const std::string& id, |
43 Extension::Location* location) const = 0; | 44 Extension::Location* location) const = 0; |
44 }; | 45 }; |
45 | 46 |
46 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_ | 47 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_ |
OLD | NEW |