| 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 SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
| 9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "google_apis/gaia/oauth2_token_service_request.h" | 10 #include "google_apis/gaia/oauth2_token_service_request.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const scoped_refptr<net::URLRequestContextGetter>& | 35 const scoped_refptr<net::URLRequestContextGetter>& |
| 36 url_request_context_getter, | 36 url_request_context_getter, |
| 37 const std::string& account_id, | 37 const std::string& account_id, |
| 38 const OAuth2TokenService::ScopeSet& scopes, | 38 const OAuth2TokenService::ScopeSet& scopes, |
| 39 const scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>& | 39 const scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>& |
| 40 token_service_provider); | 40 token_service_provider); |
| 41 virtual ~AttachmentDownloaderImpl(); | 41 virtual ~AttachmentDownloaderImpl(); |
| 42 | 42 |
| 43 // AttachmentDownloader implementation. | 43 // AttachmentDownloader implementation. |
| 44 virtual void DownloadAttachment(const AttachmentId& attachment_id, | 44 virtual void DownloadAttachment(const AttachmentId& attachment_id, |
| 45 const DownloadCallback& callback) OVERRIDE; | 45 const DownloadCallback& callback) override; |
| 46 | 46 |
| 47 // OAuth2TokenService::Consumer implementation. | 47 // OAuth2TokenService::Consumer implementation. |
| 48 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 48 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 49 const std::string& access_token, | 49 const std::string& access_token, |
| 50 const base::Time& expiration_time) OVERRIDE; | 50 const base::Time& expiration_time) override; |
| 51 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 51 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 52 const GoogleServiceAuthError& error) OVERRIDE; | 52 const GoogleServiceAuthError& error) override; |
| 53 | 53 |
| 54 // net::URLFetcherDelegate implementation. | 54 // net::URLFetcherDelegate implementation. |
| 55 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 55 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 struct DownloadState; | 58 struct DownloadState; |
| 59 typedef std::string AttachmentUrl; | 59 typedef std::string AttachmentUrl; |
| 60 typedef base::ScopedPtrHashMap<AttachmentUrl, DownloadState> StateMap; | 60 typedef base::ScopedPtrHashMap<AttachmentUrl, DownloadState> StateMap; |
| 61 typedef std::vector<DownloadState*> StateList; | 61 typedef std::vector<DownloadState*> StateList; |
| 62 | 62 |
| 63 scoped_ptr<net::URLFetcher> CreateFetcher(const AttachmentUrl& url, | 63 scoped_ptr<net::URLFetcher> CreateFetcher(const AttachmentUrl& url, |
| 64 const std::string& access_token); | 64 const std::string& access_token); |
| 65 void RequestAccessToken(DownloadState* download_state); | 65 void RequestAccessToken(DownloadState* download_state); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 82 // objects while access token request is pending. It doesn't control objects' | 82 // objects while access token request is pending. It doesn't control objects' |
| 83 // lifetime. | 83 // lifetime. |
| 84 StateList requests_waiting_for_access_token_; | 84 StateList requests_waiting_for_access_token_; |
| 85 | 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(AttachmentDownloaderImpl); | 86 DISALLOW_COPY_AND_ASSIGN(AttachmentDownloaderImpl); |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 } // namespace syncer | 89 } // namespace syncer |
| 90 | 90 |
| 91 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ | 91 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ |
| OLD | NEW |