| Index: chrome/browser/extensions/updater/extension_downloader.h
|
| diff --git a/chrome/browser/extensions/updater/extension_downloader.h b/chrome/browser/extensions/updater/extension_downloader.h
|
| index a40427da068a7daf901ac88af19dd33419202bcb..28bfc300b6bbc71436ddf419870a4fa9172a4139 100644
|
| --- a/chrome/browser/extensions/updater/extension_downloader.h
|
| +++ b/chrome/browser/extensions/updater/extension_downloader.h
|
| @@ -26,6 +26,8 @@
|
| #include "net/url_request/url_fetcher_delegate.h"
|
| #include "url/gurl.h"
|
|
|
| +class IdentityProvider;
|
| +
|
| namespace net {
|
| class URLFetcher;
|
| class URLRequestContextGetter;
|
| @@ -44,6 +46,7 @@ struct UpdateDetails {
|
|
|
| class ExtensionCache;
|
| class ExtensionUpdaterTest;
|
| +class WebstoreOAuth2TokenProvider;
|
|
|
| // A class that checks for updates of a given list of extensions, and downloads
|
| // the crx file when updates are found. It uses a |ExtensionDownloaderDelegate|
|
| @@ -52,9 +55,12 @@ class ExtensionUpdaterTest;
|
| class ExtensionDownloader : public net::URLFetcherDelegate {
|
| public:
|
| // |delegate| is stored as a raw pointer and must outlive the
|
| - // ExtensionDownloader.
|
| + // ExtensionDownloader. |webstore_identity_provider| may be NULL if this
|
| + // ExtensionDownloader does not need OAuth2 support; if not NULL, the
|
| + // given IdentityProvider must outlive this ExtensionDownloader.
|
| ExtensionDownloader(ExtensionDownloaderDelegate* delegate,
|
| - net::URLRequestContextGetter* request_context);
|
| + net::URLRequestContextGetter* request_context,
|
| + IdentityProvider* webstore_identity_provider);
|
| virtual ~ExtensionDownloader();
|
|
|
| // Adds |extension| to the list of extensions to check for updates.
|
| @@ -124,14 +130,27 @@ class ExtensionDownloader : public net::URLFetcherDelegate {
|
| const std::set<int>& request_ids);
|
| ~ExtensionFetch();
|
|
|
| + // Potentially updates this fetch's authentication state and returns |true|
|
| + // if the fetch should be retried. Returns |false| if the failure was not
|
| + // related to authentication, leaving the ExtensionFetch data unmodified.
|
| + bool IterateCredentialsAfterFailure(const net::URLRequestStatus& status,
|
| + int response_code,
|
| + bool support_oauth2);
|
| +
|
| std::string id;
|
| GURL url;
|
| std::string package_hash;
|
| std::string version;
|
| std::set<int> request_ids;
|
|
|
| - // Indicates whether or not the fetch is known to require credentials.
|
| - bool is_protected;
|
| + enum CredentialsMode {
|
| + CREDENTIALS_NONE = 0,
|
| + CREDENTIALS_OAUTH2_TOKEN,
|
| + CREDENTIALS_COOKIES,
|
| + };
|
| +
|
| + // Indicates the type of credentials to include with this fetch.
|
| + CredentialsMode credentials;
|
| };
|
|
|
| // Helper for AddExtension() and AddPendingExtension().
|
| @@ -204,6 +223,9 @@ class ExtensionDownloader : public net::URLFetcherDelegate {
|
| const base::FilePath& crx_path,
|
| bool file_ownership_passed);
|
|
|
| + // Receives an OAuth2 token to authenticate a Webstore CRX fetch.
|
| + void OnWebstoreOAuth2TokenReceived(bool success, const std::string& token);
|
| +
|
| // The delegate that receives the crx files downloaded by the
|
| // ExtensionDownloader, and that fills in optional ping and update url data.
|
| ExtensionDownloaderDelegate* delegate_;
|
| @@ -240,6 +262,9 @@ class ExtensionDownloader : public net::URLFetcherDelegate {
|
| // Cache for .crx files.
|
| ExtensionCache* extension_cache_;
|
|
|
| + // Acquires access tokens for webstore download URLs.
|
| + scoped_ptr<WebstoreOAuth2TokenProvider> webstore_token_provider_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader);
|
| };
|
|
|
|
|