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 18 matching lines...) Expand all Loading... |
29 // | 29 // |
30 // |scopes| is the set of scopes to use for downloads. | 30 // |scopes| is the set of scopes to use for downloads. |
31 // | 31 // |
32 // |token_service_provider| provides an OAuth2 token service. | 32 // |token_service_provider| provides an OAuth2 token service. |
33 AttachmentDownloaderImpl( | 33 AttachmentDownloaderImpl( |
34 const GURL& sync_service_url, | 34 const GURL& sync_service_url, |
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 scoped_ptr<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, |
(...skipping 16 matching lines...) Expand all Loading... |
66 void ReportResult( | 66 void ReportResult( |
67 const DownloadState& download_state, | 67 const DownloadState& download_state, |
68 const DownloadResult& result, | 68 const DownloadResult& result, |
69 const scoped_refptr<base::RefCountedString>& attachment_data); | 69 const scoped_refptr<base::RefCountedString>& attachment_data); |
70 | 70 |
71 GURL sync_service_url_; | 71 GURL sync_service_url_; |
72 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 72 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
73 | 73 |
74 std::string account_id_; | 74 std::string account_id_; |
75 OAuth2TokenService::ScopeSet oauth2_scopes_; | 75 OAuth2TokenService::ScopeSet oauth2_scopes_; |
76 scoped_ptr<OAuth2TokenServiceRequest::TokenServiceProvider> | 76 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> |
77 token_service_provider_; | 77 token_service_provider_; |
78 scoped_ptr<OAuth2TokenService::Request> access_token_request_; | 78 scoped_ptr<OAuth2TokenService::Request> access_token_request_; |
79 | 79 |
80 StateMap state_map_; | 80 StateMap state_map_; |
81 // |requests_waiting_for_access_token_| only keeps references to DownloadState | 81 // |requests_waiting_for_access_token_| only keeps references to DownloadState |
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 |