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/browser/external_extension_install_info.h" | |
11 #include "extensions/common/manifest.h" | 12 #include "extensions/common/manifest.h" |
12 | 13 |
13 class GURL; | 14 class GURL; |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class FilePath; | |
17 class Version; | 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 | 30 // ensure that |id| is a valid extension id (use |
31 // crx_file::id_util::IdIsValid(id)). | 31 // crx_file::id_util::IdIsValid(id)). |
32 class VisitorInterface { | 32 class VisitorInterface { |
33 public: | 33 public: |
34 // Return true if the extension install will proceed. Install will not | 34 // Return true if the extension install will proceed. Install will not |
35 // proceed if the extension is already installed from a higher priority | 35 // proceed if the extension is already installed from a higher priority |
36 // location. | 36 // location. |
37 virtual bool OnExternalExtensionFileFound( | 37 virtual bool OnExternalExtensionFileFound( |
38 const std::string& id, | 38 ExternalExtensionInstallInfoFile* info) = 0; |
asargent_no_longer_on_chrome
2016/01/25 18:50:52
nit: If ownership of this data is passed, this sho
lazyboy
2016/01/26 05:20:05
Done.
| |
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 | 39 |
46 // Return true if the extension install will proceed. Install might not | 40 // Return true if the extension install will proceed. Install might not |
47 // proceed if the extension is already installed from a higher priority | 41 // proceed if the extension is already installed from a higher priority |
48 // location. | 42 // location. |
49 virtual bool OnExternalExtensionUpdateUrlFound( | 43 virtual bool OnExternalExtensionUpdateUrlFound( |
50 const std::string& id, | 44 ExternalExtensionInstallInfoUpdateUrl* info, |
asargent_no_longer_on_chrome
2016/01/25 18:50:52
same comment re: ownership
lazyboy
2016/01/26 05:20:05
Done.
| |
51 const std::string& install_parameter, | 45 bool is_initial_load) = 0; |
52 const GURL& update_url, | |
53 Manifest::Location location, | |
54 int creation_flags, | |
55 bool mark_acknowledged) = 0; | |
56 | 46 |
57 // Called after all the external extensions have been reported | 47 // Called after all the external extensions have been reported |
58 // through the above two methods. |provider| is a pointer to the | 48 // through the above two methods. |provider| is a pointer to the |
59 // provider that is now ready (typically this), and the | 49 // provider that is now ready (typically this), and the |
60 // implementation of OnExternalProviderReady() should be able to | 50 // implementation of OnExternalProviderReady() should be able to |
61 // safely assert that provider->IsReady(). | 51 // safely assert that provider->IsReady(). |
62 virtual void OnExternalProviderReady( | 52 virtual void OnExternalProviderReady( |
63 const ExternalProviderInterface* provider) = 0; | 53 const ExternalProviderInterface* provider) = 0; |
64 | 54 |
55 // Once this provider becomes "ready", it can send additional external | |
56 // extensions it learns about later on through | |
57 // OnExternalExtensionUpdateUrlFound() or OnExternalExtensionFileFound(). | |
58 // This method will be called each time the provider finds a set of | |
59 // updated external extensions. | |
60 virtual void OnExternalProviderUpdateComplete( | |
61 const ExternalProviderInterface* provider, | |
62 const ScopedVector<ExternalExtensionInstallInfoUpdateUrl>& | |
63 update_url_extensions, | |
64 const ScopedVector<ExternalExtensionInstallInfoFile>& file_extensions, | |
65 const std::set<std::string>& removed_extensions) = 0; | |
66 | |
65 protected: | 67 protected: |
66 virtual ~VisitorInterface() {} | 68 virtual ~VisitorInterface() {} |
67 }; | 69 }; |
68 | 70 |
69 virtual ~ExternalProviderInterface() {} | 71 virtual ~ExternalProviderInterface() {} |
70 | 72 |
71 // The visitor (ExtensionsService) calls this function before it goes away. | 73 // The visitor (ExtensionsService) calls this function before it goes away. |
72 virtual void ServiceShutdown() = 0; | 74 virtual void ServiceShutdown() = 0; |
73 | 75 |
74 // Enumerate registered extensions, calling | 76 // Enumerate registered extensions, calling |
(...skipping 17 matching lines...) Expand all Loading... | |
92 // from its source. | 94 // from its source. |
93 virtual bool IsReady() const = 0; | 95 virtual bool IsReady() const = 0; |
94 }; | 96 }; |
95 | 97 |
96 typedef std::vector<linked_ptr<ExternalProviderInterface> > | 98 typedef std::vector<linked_ptr<ExternalProviderInterface> > |
97 ProviderCollection; | 99 ProviderCollection; |
98 | 100 |
99 } // namespace extensions | 101 } // namespace extensions |
100 | 102 |
101 #endif // EXTENSIONS_BROWSER_EXTERNAL_PROVIDER_INTERFACE_H_ | 103 #endif // EXTENSIONS_BROWSER_EXTERNAL_PROVIDER_INTERFACE_H_ |
OLD | NEW |