OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_API_WEBSTORE_WEBSTORE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_WEBSTORE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_WEBSTORE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_WEBSTORE_API_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 class Sender; | 27 class Sender; |
28 } | 28 } |
29 | 29 |
30 namespace extensions { | 30 namespace extensions { |
31 class InstallTracker; | 31 class InstallTracker; |
32 | 32 |
33 class WebstoreAPI : public BrowserContextKeyedAPI, | 33 class WebstoreAPI : public BrowserContextKeyedAPI, |
34 public InstallObserver { | 34 public InstallObserver { |
35 public: | 35 public: |
36 explicit WebstoreAPI(content::BrowserContext* browser_context); | 36 explicit WebstoreAPI(content::BrowserContext* browser_context); |
37 virtual ~WebstoreAPI(); | 37 ~WebstoreAPI() override; |
38 | 38 |
39 static WebstoreAPI* Get(content::BrowserContext* browser_context); | 39 static WebstoreAPI* Get(content::BrowserContext* browser_context); |
40 | 40 |
41 // Called whenever an inline extension install is started. Examines | 41 // Called whenever an inline extension install is started. Examines |
42 // |listener_mask| to determine if a download progress or install | 42 // |listener_mask| to determine if a download progress or install |
43 // stage listener should be added. | 43 // stage listener should be added. |
44 // |routing_id| refers to the id to which we send any return messages; | 44 // |routing_id| refers to the id to which we send any return messages; |
45 // |ipc_sender| is the sender through which we send them (typically this | 45 // |ipc_sender| is the sender through which we send them (typically this |
46 // is the TabHelper which started the inline install). | 46 // is the TabHelper which started the inline install). |
47 void OnInlineInstallStart(int routing_id, | 47 void OnInlineInstallStart(int routing_id, |
(...skipping 21 matching lines...) Expand all Loading... |
69 void SendInstallMessageIfObserved(const std::string& extension_id, | 69 void SendInstallMessageIfObserved(const std::string& extension_id, |
70 api::webstore::InstallStage install_stage); | 70 api::webstore::InstallStage install_stage); |
71 | 71 |
72 // Removes listeners for the given |extension_id|-|routing_id| pair from | 72 // Removes listeners for the given |extension_id|-|routing_id| pair from |
73 // |listeners|. | 73 // |listeners|. |
74 void RemoveListeners(int routing_id, | 74 void RemoveListeners(int routing_id, |
75 const std::string& extension_id, | 75 const std::string& extension_id, |
76 ObservedInstallInfoList* listeners); | 76 ObservedInstallInfoList* listeners); |
77 | 77 |
78 // InstallObserver implementation. | 78 // InstallObserver implementation. |
79 virtual void OnBeginExtensionDownload(const std::string& extension_id) | 79 void OnBeginExtensionDownload(const std::string& extension_id) override; |
80 override; | 80 void OnDownloadProgress(const std::string& extension_id, |
81 virtual void OnDownloadProgress(const std::string& extension_id, | 81 int percent_downloaded) override; |
82 int percent_downloaded) override; | 82 void OnBeginCrxInstall(const std::string& extension_id) override; |
83 virtual void OnBeginCrxInstall(const std::string& extension_id) override; | 83 void OnShutdown() override; |
84 virtual void OnShutdown() override; | |
85 | 84 |
86 // BrowserContextKeyedService implementation. | 85 // BrowserContextKeyedService implementation. |
87 virtual void Shutdown() override; | 86 void Shutdown() override; |
88 | 87 |
89 // BrowserContextKeyedAPI implementation. | 88 // BrowserContextKeyedAPI implementation. |
90 static const char* service_name() { return "WebstoreAPI"; } | 89 static const char* service_name() { return "WebstoreAPI"; } |
91 static const bool kServiceIsNULLWhileTesting = true; | 90 static const bool kServiceIsNULLWhileTesting = true; |
92 | 91 |
93 ObservedInstallInfoList download_progress_listeners_; | 92 ObservedInstallInfoList download_progress_listeners_; |
94 ObservedInstallInfoList install_stage_listeners_; | 93 ObservedInstallInfoList install_stage_listeners_; |
95 content::BrowserContext* browser_context_; | 94 content::BrowserContext* browser_context_; |
96 scoped_ptr<ScopedObserver<InstallTracker, InstallObserver> > | 95 scoped_ptr<ScopedObserver<InstallTracker, InstallObserver> > |
97 install_observer_; | 96 install_observer_; |
98 | 97 |
99 DISALLOW_COPY_AND_ASSIGN(WebstoreAPI); | 98 DISALLOW_COPY_AND_ASSIGN(WebstoreAPI); |
100 }; | 99 }; |
101 | 100 |
102 } // namespace extensions | 101 } // namespace extensions |
103 | 102 |
104 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_WEBSTORE_API_H_ | 103 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_WEBSTORE_API_H_ |
OLD | NEW |