| Index: sync/internal_api/attachments/attachment_downloader_impl.cc
|
| diff --git a/sync/internal_api/attachments/attachment_downloader_impl.cc b/sync/internal_api/attachments/attachment_downloader_impl.cc
|
| index 740c4fa03fe62c38e12f720aa4c9471430935dca..18c49d86e74182e564dcc43de1d933f46f283f96 100644
|
| --- a/sync/internal_api/attachments/attachment_downloader_impl.cc
|
| +++ b/sync/internal_api/attachments/attachment_downloader_impl.cc
|
| @@ -9,7 +9,6 @@
|
| #include "net/base/load_flags.h"
|
| #include "net/http/http_status_code.h"
|
| #include "net/url_request/url_fetcher.h"
|
| -#include "sync/internal_api/public/attachments/attachment_uploader_impl.h"
|
| #include "sync/protocol/sync.pb.h"
|
| #include "url/gurl.h"
|
|
|
| @@ -36,7 +35,7 @@
|
| }
|
|
|
| AttachmentDownloaderImpl::AttachmentDownloaderImpl(
|
| - const GURL& sync_service_url,
|
| + const std::string& url_prefix,
|
| const scoped_refptr<net::URLRequestContextGetter>&
|
| url_request_context_getter,
|
| const std::string& account_id,
|
| @@ -44,13 +43,14 @@
|
| scoped_ptr<OAuth2TokenServiceRequest::TokenServiceProvider>
|
| token_service_provider)
|
| : OAuth2TokenService::Consumer("attachment-downloader-impl"),
|
| - sync_service_url_(sync_service_url),
|
| + url_prefix_(url_prefix),
|
| url_request_context_getter_(url_request_context_getter),
|
| account_id_(account_id),
|
| oauth2_scopes_(scopes),
|
| token_service_provider_(token_service_provider.Pass()) {
|
| DCHECK(token_service_provider_);
|
| DCHECK(url_request_context_getter_);
|
| + DCHECK(!url_prefix_.empty());
|
| }
|
|
|
| AttachmentDownloaderImpl::~AttachmentDownloaderImpl() {
|
| @@ -61,8 +61,7 @@
|
| const DownloadCallback& callback) {
|
| DCHECK(CalledOnValidThread());
|
|
|
| - AttachmentUrl url = AttachmentUploaderImpl::GetURLForAttachmentId(
|
| - sync_service_url_, attachment_id).spec();
|
| + AttachmentUrl url = GetAttachmentUrl(attachment_id);
|
|
|
| StateMap::iterator iter = state_map_.find(url);
|
| if (iter == state_map_.end()) {
|
| @@ -150,6 +149,11 @@
|
| }
|
| ReportResult(download_state, result, attachment_data);
|
| state_map_.erase(iter);
|
| +}
|
| +
|
| +AttachmentDownloaderImpl::AttachmentUrl
|
| +AttachmentDownloaderImpl::GetAttachmentUrl(const AttachmentId& attachment_id) {
|
| + return url_prefix_ + attachment_id.GetProto().unique_id();
|
| }
|
|
|
| scoped_ptr<net::URLFetcher> AttachmentDownloaderImpl::CreateFetcher(
|
|
|