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_WEBSTORE_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // prompt if the actual manifest from the extension to be installed matches | 110 // prompt if the actual manifest from the extension to be installed matches |
111 // |parsed_manifest|. The |strict_manifest_check| controls whether we want | 111 // |parsed_manifest|. The |strict_manifest_check| controls whether we want |
112 // to require an exact manifest match, or are willing to tolerate a looser | 112 // to require an exact manifest match, or are willing to tolerate a looser |
113 // check just that the effective permissions are the same. | 113 // check just that the effective permissions are the same. |
114 static scoped_ptr<Approval> CreateWithNoInstallPrompt( | 114 static scoped_ptr<Approval> CreateWithNoInstallPrompt( |
115 Profile* profile, | 115 Profile* profile, |
116 const std::string& extension_id, | 116 const std::string& extension_id, |
117 scoped_ptr<base::DictionaryValue> parsed_manifest, | 117 scoped_ptr<base::DictionaryValue> parsed_manifest, |
118 bool strict_manifest_check); | 118 bool strict_manifest_check); |
119 | 119 |
120 virtual ~Approval(); | 120 ~Approval() override; |
121 | 121 |
122 // The extension id that was approved for installation. | 122 // The extension id that was approved for installation. |
123 std::string extension_id; | 123 std::string extension_id; |
124 | 124 |
125 // The profile the extension should be installed into. | 125 // The profile the extension should be installed into. |
126 Profile* profile; | 126 Profile* profile; |
127 | 127 |
128 // The expected manifest, before localization. | 128 // The expected manifest, before localization. |
129 scoped_ptr<Manifest> manifest; | 129 scoped_ptr<Manifest> manifest; |
130 | 130 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 Delegate* delegate, | 187 Delegate* delegate, |
188 content::WebContents* web_contents, | 188 content::WebContents* web_contents, |
189 const std::string& id, | 189 const std::string& id, |
190 scoped_ptr<Approval> approval, | 190 scoped_ptr<Approval> approval, |
191 InstallSource source); | 191 InstallSource source); |
192 | 192 |
193 // Starts downloading and installing the extension. | 193 // Starts downloading and installing the extension. |
194 void Start(); | 194 void Start(); |
195 | 195 |
196 // content::NotificationObserver. | 196 // content::NotificationObserver. |
197 virtual void Observe(int type, | 197 void Observe(int type, |
198 const content::NotificationSource& source, | 198 const content::NotificationSource& source, |
199 const content::NotificationDetails& details) override; | 199 const content::NotificationDetails& details) override; |
200 | 200 |
201 // ExtensionRegistryObserver. | 201 // ExtensionRegistryObserver. |
202 virtual void OnExtensionInstalled(content::BrowserContext* browser_context, | 202 void OnExtensionInstalled(content::BrowserContext* browser_context, |
203 const Extension* extension, | 203 const Extension* extension, |
204 bool is_update) override; | 204 bool is_update) override; |
205 | 205 |
206 // Removes the reference to the delegate passed in the constructor. Used when | 206 // Removes the reference to the delegate passed in the constructor. Used when |
207 // the delegate object must be deleted before this object. | 207 // the delegate object must be deleted before this object. |
208 void InvalidateDelegate(); | 208 void InvalidateDelegate(); |
209 | 209 |
210 // Instead of using the default download directory, use |directory| instead. | 210 // Instead of using the default download directory, use |directory| instead. |
211 // This does *not* transfer ownership of |directory|. | 211 // This does *not* transfer ownership of |directory|. |
212 static void SetDownloadDirectoryForTests(base::FilePath* directory); | 212 static void SetDownloadDirectoryForTests(base::FilePath* directory); |
213 | 213 |
214 private: | 214 private: |
215 FRIEND_TEST_ALL_PREFIXES(WebstoreInstallerTest, PlatformParams); | 215 FRIEND_TEST_ALL_PREFIXES(WebstoreInstallerTest, PlatformParams); |
216 friend struct content::BrowserThread::DeleteOnThread< | 216 friend struct content::BrowserThread::DeleteOnThread< |
217 content::BrowserThread::UI>; | 217 content::BrowserThread::UI>; |
218 friend class base::DeleteHelper<WebstoreInstaller>; | 218 friend class base::DeleteHelper<WebstoreInstaller>; |
219 virtual ~WebstoreInstaller(); | 219 ~WebstoreInstaller() override; |
220 | 220 |
221 // Helper to get install URL. | 221 // Helper to get install URL. |
222 static GURL GetWebstoreInstallURL(const std::string& extension_id, | 222 static GURL GetWebstoreInstallURL(const std::string& extension_id, |
223 InstallSource source); | 223 InstallSource source); |
224 | 224 |
225 // DownloadManager::DownloadUrl callback. | 225 // DownloadManager::DownloadUrl callback. |
226 void OnDownloadStarted(content::DownloadItem* item, | 226 void OnDownloadStarted(content::DownloadItem* item, |
227 content::DownloadInterruptReason interrupt_reason); | 227 content::DownloadInterruptReason interrupt_reason); |
228 | 228 |
229 // DownloadItem::Observer implementation: | 229 // DownloadItem::Observer implementation: |
230 virtual void OnDownloadUpdated(content::DownloadItem* download) override; | 230 void OnDownloadUpdated(content::DownloadItem* download) override; |
231 virtual void OnDownloadDestroyed(content::DownloadItem* download) override; | 231 void OnDownloadDestroyed(content::DownloadItem* download) override; |
232 | 232 |
233 // Downloads next pending module in |pending_modules_|. | 233 // Downloads next pending module in |pending_modules_|. |
234 void DownloadNextPendingModule(); | 234 void DownloadNextPendingModule(); |
235 | 235 |
236 // Downloads and installs a single Crx with the given |extension_id|. | 236 // Downloads and installs a single Crx with the given |extension_id|. |
237 // This function is used for both the extension Crx and dependences. | 237 // This function is used for both the extension Crx and dependences. |
238 void DownloadCrx(const std::string& extension_id, InstallSource source); | 238 void DownloadCrx(const std::string& extension_id, InstallSource source); |
239 | 239 |
240 // Starts downloading the extension to |file_path|. | 240 // Starts downloading the extension to |file_path|. |
241 void StartDownload(const base::FilePath& file_path); | 241 void StartDownload(const base::FilePath& file_path); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 std::list<SharedModuleInfo::ImportInfo> pending_modules_; | 280 std::list<SharedModuleInfo::ImportInfo> pending_modules_; |
281 // Total extension modules we need download and install (the main module and | 281 // Total extension modules we need download and install (the main module and |
282 // depedences). | 282 // depedences). |
283 int total_modules_; | 283 int total_modules_; |
284 bool download_started_; | 284 bool download_started_; |
285 }; | 285 }; |
286 | 286 |
287 } // namespace extensions | 287 } // namespace extensions |
288 | 288 |
289 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ | 289 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
OLD | NEW |