OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_EXTERNAL_PROVIDER_INTERFACE_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTERNAL_PROVIDER_INTERFACE_H_ |
6 #define EXTENSIONS_BROWSER_EXTERNAL_PROVIDER_INTERFACE_H_ | 6 #define EXTENSIONS_BROWSER_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 "extensions/common/manifest.h" | 11 #include "extensions/common/manifest.h" |
12 | 12 |
13 class GURL; | 13 class GURL; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class FilePath; | |
17 class Version; | 16 class Version; |
18 } | 17 } |
19 | 18 |
20 namespace extensions { | 19 namespace extensions { |
21 | 20 |
| 21 struct ExternalInstallInfoFile; |
| 22 struct ExternalInstallInfoUpdateUrl; |
| 23 |
22 // This class is an abstract class for implementing external extensions | 24 // This class is an abstract class for implementing external extensions |
23 // providers. | 25 // providers. |
24 class ExternalProviderInterface { | 26 class ExternalProviderInterface { |
25 public: | 27 public: |
26 // ExternalProvider uses this interface to communicate back to the | 28 // ExternalProvider uses this interface to communicate back to the |
27 // caller what extensions are registered, and which |id|, |version| and |path| | 29 // caller what extensions are registered, and which |id|, |version| and |path| |
28 // they have. See also VisitRegisteredExtension below. Ownership of |version| | 30 // they have. See also VisitRegisteredExtension below. Ownership of |version| |
29 // is not transferred to the visitor. Callers of the methods below must | 31 // is not transferred to the visitor. Callers of the methods below must |
30 // ensure that |id| is a valid extension id (use | 32 // ensure that |id| is a valid extension id (use |
31 // crx_file::id_util::IdIsValid(id)). | 33 // crx_file::id_util::IdIsValid(id)). |
32 class VisitorInterface { | 34 class VisitorInterface { |
33 public: | 35 public: |
34 // Return true if the extension install will proceed. Install will not | 36 // Return true if the extension install will proceed. Install will not |
35 // proceed if the extension is already installed from a higher priority | 37 // proceed if the extension is already installed from a higher priority |
36 // location. | 38 // location. |
37 virtual bool OnExternalExtensionFileFound( | 39 virtual bool OnExternalExtensionFileFound( |
38 const std::string& id, | 40 const ExternalInstallInfoFile& info) = 0; |
39 const base::Version* version, | |
40 const base::FilePath& path, | |
41 Manifest::Location location, | |
42 int creation_flags, | |
43 bool mark_acknowledged, | |
44 bool install_immediately) = 0; | |
45 | 41 |
46 // Return true if the extension install will proceed. Install might not | 42 // Return true if the extension install will proceed. Install might not |
47 // proceed if the extension is already installed from a higher priority | 43 // proceed if the extension is already installed from a higher priority |
48 // location. | 44 // location. |
49 virtual bool OnExternalExtensionUpdateUrlFound( | 45 virtual bool OnExternalExtensionUpdateUrlFound( |
50 const std::string& id, | 46 const ExternalInstallInfoUpdateUrl& info, |
51 const std::string& install_parameter, | 47 bool is_initial_load) = 0; |
52 const GURL& update_url, | |
53 Manifest::Location location, | |
54 int creation_flags, | |
55 bool mark_acknowledged) = 0; | |
56 | 48 |
57 // Called after all the external extensions have been reported | 49 // Called after all the external extensions have been reported |
58 // through the above two methods. |provider| is a pointer to the | 50 // through the above two methods. |provider| is a pointer to the |
59 // provider that is now ready (typically this), and the | 51 // provider that is now ready (typically this), and the |
60 // implementation of OnExternalProviderReady() should be able to | 52 // implementation of OnExternalProviderReady() should be able to |
61 // safely assert that provider->IsReady(). | 53 // safely assert that provider->IsReady(). |
62 virtual void OnExternalProviderReady( | 54 virtual void OnExternalProviderReady( |
63 const ExternalProviderInterface* provider) = 0; | 55 const ExternalProviderInterface* provider) = 0; |
64 | 56 |
| 57 // Once this provider becomes "ready", it can send additional external |
| 58 // extensions it learns about later on through |
| 59 // OnExternalExtensionUpdateUrlFound() or OnExternalExtensionFileFound(). |
| 60 // This method will be called each time the provider finds a set of |
| 61 // updated external extensions. |
| 62 virtual void OnExternalProviderUpdateComplete( |
| 63 const ExternalProviderInterface* provider, |
| 64 const ScopedVector<ExternalInstallInfoUpdateUrl>& update_url_extensions, |
| 65 const ScopedVector<ExternalInstallInfoFile>& file_extensions, |
| 66 const std::set<std::string>& removed_extensions) = 0; |
| 67 |
65 protected: | 68 protected: |
66 virtual ~VisitorInterface() {} | 69 virtual ~VisitorInterface() {} |
67 }; | 70 }; |
68 | 71 |
69 virtual ~ExternalProviderInterface() {} | 72 virtual ~ExternalProviderInterface() {} |
70 | 73 |
71 // The visitor (ExtensionsService) calls this function before it goes away. | 74 // The visitor (ExtensionsService) calls this function before it goes away. |
72 virtual void ServiceShutdown() = 0; | 75 virtual void ServiceShutdown() = 0; |
73 | 76 |
74 // Enumerate registered extensions, calling | 77 // Enumerate registered extensions, calling |
(...skipping 17 matching lines...) Expand all Loading... |
92 // from its source. | 95 // from its source. |
93 virtual bool IsReady() const = 0; | 96 virtual bool IsReady() const = 0; |
94 }; | 97 }; |
95 | 98 |
96 typedef std::vector<linked_ptr<ExternalProviderInterface> > | 99 typedef std::vector<linked_ptr<ExternalProviderInterface> > |
97 ProviderCollection; | 100 ProviderCollection; |
98 | 101 |
99 } // namespace extensions | 102 } // namespace extensions |
100 | 103 |
101 #endif // EXTENSIONS_BROWSER_EXTERNAL_PROVIDER_INTERFACE_H_ | 104 #endif // EXTENSIONS_BROWSER_EXTERNAL_PROVIDER_INTERFACE_H_ |
OLD | NEW |