| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual 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 virtual 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 virtual ~WebstoreInstaller(); |
| 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 virtual void OnDownloadUpdated(content::DownloadItem* download) override; |
| 231 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; | 231 virtual 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 |