[email protected] | 29679dea | 2012-03-10 03:20:28 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
| 6 | #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 7 | |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 8 | #include <list> |
dcheng | c963c714 | 2016-04-08 03:55:22 | [diff] [blame] | 9 | #include <memory> |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 10 | #include <string> |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 11 | |
| 12 | #include "base/compiler_specific.h" |
thestig | a0e18cd | 2015-09-25 04:58:36 | [diff] [blame] | 13 | #include "base/gtest_prod_util.h" |
[email protected] | 98e4e52 | 2011-10-25 13:00:16 | [diff] [blame] | 14 | #include "base/memory/ref_counted.h" |
[email protected] | 17f0782 | 2014-05-22 08:45:15 | [diff] [blame] | 15 | #include "base/scoped_observer.h" |
[email protected] | d59d40c | 2012-08-08 18:18:37 | [diff] [blame] | 16 | #include "base/supports_user_data.h" |
[email protected] | c80fe5f | 2014-03-26 04:36:30 | [diff] [blame] | 17 | #include "base/timer/timer.h" |
[email protected] | 21a5ad6 | 2012-04-03 04:48:45 | [diff] [blame] | 18 | #include "base/values.h" |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 19 | #include "base/version.h" |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 20 | #include "chrome/browser/extensions/extension_install_prompt.h" |
[email protected] | ed0757ec | 2012-08-02 17:23:26 | [diff] [blame] | 21 | #include "content/public/browser/browser_thread.h" |
[email protected] | 7f391888 | 2014-01-14 06:14:56 | [diff] [blame] | 22 | #include "content/public/browser/download_interrupt_reasons.h" |
[email protected] | 8adbe311 | 2012-03-27 05:42:22 | [diff] [blame] | 23 | #include "content/public/browser/download_item.h" |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 24 | #include "content/public/browser/notification_observer.h" |
| 25 | #include "content/public/browser/notification_registrar.h" |
[email protected] | 2acf3a5 | 2014-02-13 00:26:00 | [diff] [blame] | 26 | #include "content/public/browser/web_contents_observer.h" |
[email protected] | 17f0782 | 2014-05-22 08:45:15 | [diff] [blame] | 27 | #include "extensions/browser/extension_registry_observer.h" |
[email protected] | 301116c6 | 2013-11-26 10:37:45 | [diff] [blame] | 28 | #include "extensions/common/manifest_handlers/shared_module_info.h" |
[email protected] | 7b4eea60 | 2013-02-08 06:19:47 | [diff] [blame] | 29 | #include "ui/gfx/image/image_skia.h" |
[email protected] | a6483d2 | 2013-07-03 22:11:00 | [diff] [blame] | 30 | #include "url/gurl.h" |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 31 | |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 32 | class Profile; |
| 33 | |
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 34 | namespace base { |
| 35 | class FilePath; |
| 36 | } |
| 37 | |
[email protected] | cdcb1dee | 2012-01-04 00:46:20 | [diff] [blame] | 38 | namespace content { |
[email protected] | 2acf3a5 | 2014-02-13 00:26:00 | [diff] [blame] | 39 | class WebContents; |
[email protected] | cdcb1dee | 2012-01-04 00:46:20 | [diff] [blame] | 40 | } |
| 41 | |
[email protected] | 3d61a7f | 2012-07-12 19:11:25 | [diff] [blame] | 42 | namespace extensions { |
| 43 | |
[email protected] | 5206ae8 | 2014-04-23 12:03:33 | [diff] [blame] | 44 | class CrxInstaller; |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 45 | class Extension; |
[email protected] | 17f0782 | 2014-05-22 08:45:15 | [diff] [blame] | 46 | class ExtensionRegistry; |
[email protected] | 21c0104 | 2013-03-10 23:41:14 | [diff] [blame] | 47 | class Manifest; |
| 48 | |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 49 | // Downloads and installs extensions from the web store. |
[email protected] | 2acf3a5 | 2014-02-13 00:26:00 | [diff] [blame] | 50 | class WebstoreInstaller : public content::NotificationObserver, |
[email protected] | 17f0782 | 2014-05-22 08:45:15 | [diff] [blame] | 51 | public ExtensionRegistryObserver, |
[email protected] | 2acf3a5 | 2014-02-13 00:26:00 | [diff] [blame] | 52 | public content::DownloadItem::Observer, |
| 53 | public content::WebContentsObserver, |
| 54 | public base::RefCountedThreadSafe< |
[email protected] | 17f0782 | 2014-05-22 08:45:15 | [diff] [blame] | 55 | WebstoreInstaller, |
| 56 | content::BrowserThread::DeleteOnUIThread> { |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 57 | public: |
[email protected] | 084e3548 | 2013-09-25 02:46:19 | [diff] [blame] | 58 | enum InstallSource { |
[email protected] | 99dfecd | 2011-10-18 01:11:50 | [diff] [blame] | 59 | // Inline installs trigger slightly different behavior (install source |
| 60 | // is different, download referrers are the item's page in the gallery). |
[email protected] | 084e3548 | 2013-09-25 02:46:19 | [diff] [blame] | 61 | INSTALL_SOURCE_INLINE, |
| 62 | INSTALL_SOURCE_APP_LAUNCHER, |
| 63 | INSTALL_SOURCE_OTHER |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 64 | }; |
| 65 | |
[email protected] | bcd1eaf7 | 2012-10-03 05:42:29 | [diff] [blame] | 66 | enum FailureReason { |
| 67 | FAILURE_REASON_CANCELLED, |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 68 | FAILURE_REASON_DEPENDENCY_NOT_FOUND, |
| 69 | FAILURE_REASON_DEPENDENCY_NOT_SHARED_MODULE, |
[email protected] | bcd1eaf7 | 2012-10-03 05:42:29 | [diff] [blame] | 70 | FAILURE_REASON_OTHER |
| 71 | }; |
| 72 | |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 73 | enum ManifestCheckLevel { |
| 74 | // Do not check for any manifest equality. |
| 75 | MANIFEST_CHECK_LEVEL_NONE, |
| 76 | |
| 77 | // Only check that the expected and actual permissions have the same |
| 78 | // effective permissions. |
| 79 | MANIFEST_CHECK_LEVEL_LOOSE, |
| 80 | |
| 81 | // All data in the expected and actual manifests must match. |
| 82 | MANIFEST_CHECK_LEVEL_STRICT, |
| 83 | }; |
| 84 | |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 85 | class Delegate { |
| 86 | public: |
[email protected] | bcd1eaf7 | 2012-10-03 05:42:29 | [diff] [blame] | 87 | virtual void OnExtensionDownloadStarted(const std::string& id, |
| 88 | content::DownloadItem* item); |
| 89 | virtual void OnExtensionDownloadProgress(const std::string& id, |
| 90 | content::DownloadItem* item); |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 91 | virtual void OnExtensionInstallSuccess(const std::string& id) = 0; |
| 92 | virtual void OnExtensionInstallFailure(const std::string& id, |
[email protected] | bcd1eaf7 | 2012-10-03 05:42:29 | [diff] [blame] | 93 | const std::string& error, |
| 94 | FailureReason reason) = 0; |
[email protected] | 512d03f | 2012-06-26 01:06:06 | [diff] [blame] | 95 | |
| 96 | protected: |
| 97 | virtual ~Delegate() {} |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 98 | }; |
| 99 | |
[email protected] | 89019d6 | 2012-05-17 18:47:09 | [diff] [blame] | 100 | // Contains information about what parts of the extension install process can |
| 101 | // be skipped or modified. If one of these is present, it means that a CRX |
| 102 | // download was initiated by WebstoreInstaller. The Approval instance should |
| 103 | // be checked further for additional details. |
[email protected] | d59d40c | 2012-08-08 18:18:37 | [diff] [blame] | 104 | struct Approval : public base::SupportsUserData::Data { |
dcheng | c963c714 | 2016-04-08 03:55:22 | [diff] [blame] | 105 | static std::unique_ptr<Approval> CreateWithInstallPrompt(Profile* profile); |
[email protected] | 8529082 | 2013-08-23 20:27:38 | [diff] [blame] | 106 | |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 107 | // Creates an Approval for installing a shared module. |
dcheng | c963c714 | 2016-04-08 03:55:22 | [diff] [blame] | 108 | static std::unique_ptr<Approval> CreateForSharedModule(Profile* profile); |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 109 | |
[email protected] | 8529082 | 2013-08-23 20:27:38 | [diff] [blame] | 110 | // Creates an Approval that will skip putting up an install confirmation |
| 111 | // prompt if the actual manifest from the extension to be installed matches |
| 112 | // |parsed_manifest|. The |strict_manifest_check| controls whether we want |
| 113 | // to require an exact manifest match, or are willing to tolerate a looser |
| 114 | // check just that the effective permissions are the same. |
dcheng | c963c714 | 2016-04-08 03:55:22 | [diff] [blame] | 115 | static std::unique_ptr<Approval> CreateWithNoInstallPrompt( |
[email protected] | 89019d6 | 2012-05-17 18:47:09 | [diff] [blame] | 116 | Profile* profile, |
| 117 | const std::string& extension_id, |
dcheng | c963c714 | 2016-04-08 03:55:22 | [diff] [blame] | 118 | std::unique_ptr<base::DictionaryValue> parsed_manifest, |
[email protected] | 8529082 | 2013-08-23 20:27:38 | [diff] [blame] | 119 | bool strict_manifest_check); |
[email protected] | 89019d6 | 2012-05-17 18:47:09 | [diff] [blame] | 120 | |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 121 | ~Approval() override; |
[email protected] | 21a5ad6 | 2012-04-03 04:48:45 | [diff] [blame] | 122 | |
| 123 | // The extension id that was approved for installation. |
| 124 | std::string extension_id; |
| 125 | |
| 126 | // The profile the extension should be installed into. |
| 127 | Profile* profile; |
| 128 | |
| 129 | // The expected manifest, before localization. |
dcheng | c963c714 | 2016-04-08 03:55:22 | [diff] [blame] | 130 | std::unique_ptr<Manifest> manifest; |
[email protected] | 21a5ad6 | 2012-04-03 04:48:45 | [diff] [blame] | 131 | |
| 132 | // Whether to use a bubble notification when an app is installed, instead of |
| 133 | // the default behavior of transitioning to the new tab page. |
| 134 | bool use_app_installed_bubble; |
| 135 | |
| 136 | // Whether to skip the post install UI like the extension installed bubble. |
| 137 | bool skip_post_install_ui; |
[email protected] | 89019d6 | 2012-05-17 18:47:09 | [diff] [blame] | 138 | |
| 139 | // Whether to skip the install dialog once the extension has been downloaded |
| 140 | // and unpacked. One reason this can be true is that in the normal webstore |
| 141 | // installation, the dialog is shown earlier, before any download is done, |
| 142 | // so there's no need to show it again. |
| 143 | bool skip_install_dialog; |
| 144 | |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 145 | // Manifest check level for checking actual manifest against expected |
| 146 | // manifest. |
| 147 | ManifestCheckLevel manifest_check_level; |
[email protected] | 8529082 | 2013-08-23 20:27:38 | [diff] [blame] | 148 | |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 149 | // Used to show the install dialog. |
| 150 | ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback; |
| 151 | |
[email protected] | 7b4eea60 | 2013-02-08 06:19:47 | [diff] [blame] | 152 | // The icon to use to display the extension while it is installing. |
| 153 | gfx::ImageSkia installing_icon; |
| 154 | |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 155 | // A dummy extension created from |manifest|; |
| 156 | scoped_refptr<Extension> dummy_extension; |
| 157 | |
| 158 | // Required minimum version. |
pwnall | cbd7319 | 2016-08-22 18:59:17 | [diff] [blame^] | 159 | std::unique_ptr<base::Version> minimum_version; |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 160 | |
[email protected] | e768495 | 2014-05-09 21:41:35 | [diff] [blame] | 161 | // The authuser index required to download the item being installed. May be |
| 162 | // the empty string, in which case no authuser parameter is used. |
| 163 | std::string authuser; |
| 164 | |
[email protected] | 89019d6 | 2012-05-17 18:47:09 | [diff] [blame] | 165 | private: |
| 166 | Approval(); |
[email protected] | 21a5ad6 | 2012-04-03 04:48:45 | [diff] [blame] | 167 | }; |
| 168 | |
| 169 | // Gets the Approval associated with the |download|, or NULL if there's none. |
| 170 | // Note that the Approval is owned by |download|. |
| 171 | static const Approval* GetAssociatedApproval( |
| 172 | const content::DownloadItem& download); |
| 173 | |
[email protected] | 98e4e52 | 2011-10-25 13:00:16 | [diff] [blame] | 174 | // Creates a WebstoreInstaller for downloading and installing the extension |
| 175 | // with the given |id| from the Chrome Web Store. If |delegate| is not NULL, |
| 176 | // it will be notified when the install succeeds or fails. The installer will |
| 177 | // use the specified |controller| to download the extension. Only one |
[email protected] | 21a5ad6 | 2012-04-03 04:48:45 | [diff] [blame] | 178 | // WebstoreInstaller can use a specific controller at any given time. This |
| 179 | // also associates the |approval| with this install. |
[email protected] | 98e4e52 | 2011-10-25 13:00:16 | [diff] [blame] | 180 | // Note: the delegate should stay alive until being called back. |
| 181 | WebstoreInstaller(Profile* profile, |
| 182 | Delegate* delegate, |
[email protected] | 2acf3a5 | 2014-02-13 00:26:00 | [diff] [blame] | 183 | content::WebContents* web_contents, |
[email protected] | 98e4e52 | 2011-10-25 13:00:16 | [diff] [blame] | 184 | const std::string& id, |
dcheng | c963c714 | 2016-04-08 03:55:22 | [diff] [blame] | 185 | std::unique_ptr<Approval> approval, |
[email protected] | 084e3548 | 2013-09-25 02:46:19 | [diff] [blame] | 186 | InstallSource source); |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 187 | |
[email protected] | 98e4e52 | 2011-10-25 13:00:16 | [diff] [blame] | 188 | // Starts downloading and installing the extension. |
| 189 | void Start(); |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 190 | |
[email protected] | 17f0782 | 2014-05-22 08:45:15 | [diff] [blame] | 191 | // content::NotificationObserver. |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 192 | void Observe(int type, |
| 193 | const content::NotificationSource& source, |
| 194 | const content::NotificationDetails& details) override; |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 195 | |
[email protected] | 17f0782 | 2014-05-22 08:45:15 | [diff] [blame] | 196 | // ExtensionRegistryObserver. |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 197 | void OnExtensionInstalled(content::BrowserContext* browser_context, |
| 198 | const Extension* extension, |
| 199 | bool is_update) override; |
[email protected] | 17f0782 | 2014-05-22 08:45:15 | [diff] [blame] | 200 | |
[email protected] | e074e32 | 2012-10-30 01:12:09 | [diff] [blame] | 201 | // Removes the reference to the delegate passed in the constructor. Used when |
| 202 | // the delegate object must be deleted before this object. |
| 203 | void InvalidateDelegate(); |
| 204 | |
[email protected] | 9c265d0 | 2011-12-29 22:13:43 | [diff] [blame] | 205 | // Instead of using the default download directory, use |directory| instead. |
| 206 | // This does *not* transfer ownership of |directory|. |
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 207 | static void SetDownloadDirectoryForTests(base::FilePath* directory); |
[email protected] | 9c265d0 | 2011-12-29 22:13:43 | [diff] [blame] | 208 | |
amistry | 7d82d50a | 2015-01-12 20:17:28 | [diff] [blame] | 209 | protected: |
| 210 | // For testing. |
| 211 | ~WebstoreInstaller() override; |
| 212 | |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 213 | private: |
[email protected] | 902a8a01 | 2013-05-04 05:04:16 | [diff] [blame] | 214 | FRIEND_TEST_ALL_PREFIXES(WebstoreInstallerTest, PlatformParams); |
[email protected] | ed0757ec | 2012-08-02 17:23:26 | [diff] [blame] | 215 | friend struct content::BrowserThread::DeleteOnThread< |
amistry | 7d82d50a | 2015-01-12 20:17:28 | [diff] [blame] | 216 | content::BrowserThread::UI>; |
[email protected] | ed0757ec | 2012-08-02 17:23:26 | [diff] [blame] | 217 | friend class base::DeleteHelper<WebstoreInstaller>; |
[email protected] | 5f2a475 | 2012-04-27 22:18:58 | [diff] [blame] | 218 | |
[email protected] | 902a8a01 | 2013-05-04 05:04:16 | [diff] [blame] | 219 | // Helper to get install URL. |
| 220 | static GURL GetWebstoreInstallURL(const std::string& extension_id, |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 221 | InstallSource source); |
[email protected] | 902a8a01 | 2013-05-04 05:04:16 | [diff] [blame] | 222 | |
[email protected] | 8adbe311 | 2012-03-27 05:42:22 | [diff] [blame] | 223 | // DownloadManager::DownloadUrl callback. |
amistry | 7d82d50a | 2015-01-12 20:17:28 | [diff] [blame] | 224 | void OnDownloadStarted(const std::string& extension_id, |
| 225 | content::DownloadItem* item, |
[email protected] | 7f391888 | 2014-01-14 06:14:56 | [diff] [blame] | 226 | content::DownloadInterruptReason interrupt_reason); |
[email protected] | 8adbe311 | 2012-03-27 05:42:22 | [diff] [blame] | 227 | |
| 228 | // DownloadItem::Observer implementation: |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 229 | void OnDownloadUpdated(content::DownloadItem* download) override; |
| 230 | void OnDownloadDestroyed(content::DownloadItem* download) override; |
[email protected] | 8adbe311 | 2012-03-27 05:42:22 | [diff] [blame] | 231 | |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 232 | // Downloads next pending module in |pending_modules_|. |
| 233 | void DownloadNextPendingModule(); |
| 234 | |
| 235 | // Downloads and installs a single Crx with the given |extension_id|. |
| 236 | // This function is used for both the extension Crx and dependences. |
| 237 | void DownloadCrx(const std::string& extension_id, InstallSource source); |
| 238 | |
amistry | 7d82d50a | 2015-01-12 20:17:28 | [diff] [blame] | 239 | // Starts downloading the extension with ID |extension_id| to |file_path|. |
| 240 | void StartDownload(const std::string& extension_id, |
| 241 | const base::FilePath& file_path); |
[email protected] | f66a50a | 2011-11-02 23:53:46 | [diff] [blame] | 242 | |
[email protected] | c80fe5f | 2014-03-26 04:36:30 | [diff] [blame] | 243 | // Updates the InstallTracker with the latest download progress. |
| 244 | void UpdateDownloadProgress(); |
| 245 | |
[email protected] | 5206ae8 | 2014-04-23 12:03:33 | [diff] [blame] | 246 | // Creates and starts CrxInstaller for the downloaded extension package. |
| 247 | void StartCrxInstaller(const content::DownloadItem& item); |
| 248 | |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 249 | // Reports an install |error| to the delegate for the given extension if this |
| 250 | // managed its installation. This also removes the associated PendingInstall. |
[email protected] | bcd1eaf7 | 2012-10-03 05:42:29 | [diff] [blame] | 251 | void ReportFailure(const std::string& error, FailureReason reason); |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 252 | |
| 253 | // Reports a successful install to the delegate for the given extension if |
| 254 | // this managed its installation. This also removes the associated |
| 255 | // PendingInstall. |
[email protected] | 98e4e52 | 2011-10-25 13:00:16 | [diff] [blame] | 256 | void ReportSuccess(); |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 257 | |
[email protected] | 0a2a724 | 2013-11-20 20:49:24 | [diff] [blame] | 258 | // Records stats regarding an interrupted webstore download item. |
| 259 | void RecordInterrupt(const content::DownloadItem* download) const; |
| 260 | |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 261 | content::NotificationRegistrar registrar_; |
[email protected] | 17f0782 | 2014-05-22 08:45:15 | [diff] [blame] | 262 | ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 263 | extension_registry_observer_; |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 264 | Profile* profile_; |
[email protected] | 98e4e52 | 2011-10-25 13:00:16 | [diff] [blame] | 265 | Delegate* delegate_; |
[email protected] | 98e4e52 | 2011-10-25 13:00:16 | [diff] [blame] | 266 | std::string id_; |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 267 | InstallSource install_source_; |
[email protected] | 8adbe311 | 2012-03-27 05:42:22 | [diff] [blame] | 268 | // The DownloadItem is owned by the DownloadManager and is valid from when |
[email protected] | 81b80bc | 2012-08-31 18:27:44 | [diff] [blame] | 269 | // OnDownloadStarted is called (with no error) until OnDownloadDestroyed(). |
[email protected] | 8adbe311 | 2012-03-27 05:42:22 | [diff] [blame] | 270 | content::DownloadItem* download_item_; |
[email protected] | c80fe5f | 2014-03-26 04:36:30 | [diff] [blame] | 271 | // Used to periodically update the extension's download status. This will |
| 272 | // trigger at least every second, though sometimes more frequently (depending |
| 273 | // on number of modules, etc). |
danakj | 8c3eb80 | 2015-09-24 07:53:00 | [diff] [blame] | 274 | base::OneShotTimer download_progress_timer_; |
dcheng | c963c714 | 2016-04-08 03:55:22 | [diff] [blame] | 275 | std::unique_ptr<Approval> approval_; |
[email protected] | 98e4e52 | 2011-10-25 13:00:16 | [diff] [blame] | 276 | GURL download_url_; |
[email protected] | 5206ae8 | 2014-04-23 12:03:33 | [diff] [blame] | 277 | scoped_refptr<CrxInstaller> crx_installer_; |
[email protected] | 669b237 | 2013-10-17 15:04:58 | [diff] [blame] | 278 | |
| 279 | // Pending modules. |
| 280 | std::list<SharedModuleInfo::ImportInfo> pending_modules_; |
| 281 | // Total extension modules we need download and install (the main module and |
| 282 | // depedences). |
| 283 | int total_modules_; |
| 284 | bool download_started_; |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 285 | }; |
| 286 | |
[email protected] | 3d61a7f | 2012-07-12 19:11:25 | [diff] [blame] | 287 | } // namespace extensions |
| 288 | |
[email protected] | 655b2b1a | 2011-10-13 17:13:06 | [diff] [blame] | 289 | #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |