OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void DocumentsService::GetAccountMetadata(const GetDataCallback& callback) { | 103 void DocumentsService::GetAccountMetadata(const GetDataCallback& callback) { |
104 GetAccountMetadataOperation* operation = | 104 GetAccountMetadataOperation* operation = |
105 new GetAccountMetadataOperation(operation_registry_.get(), | 105 new GetAccountMetadataOperation(operation_registry_.get(), |
106 profile_, | 106 profile_, |
107 callback); | 107 callback); |
108 StartOperationOnUIThread(operation); | 108 StartOperationOnUIThread(operation); |
109 } | 109 } |
110 | 110 |
111 void DocumentsService::DownloadDocument( | 111 void DocumentsService::DownloadDocument( |
112 const FilePath& virtual_path, | 112 const FilePath& virtual_path, |
| 113 const FilePath& local_cache_path, |
113 const GURL& document_url, | 114 const GURL& document_url, |
114 DocumentExportFormat format, | 115 DocumentExportFormat format, |
115 const DownloadActionCallback& callback) { | 116 const DownloadActionCallback& callback) { |
116 DownloadFile( | 117 DownloadFile( |
117 virtual_path, | 118 virtual_path, |
| 119 local_cache_path, |
118 chrome_browser_net::AppendQueryParameter(document_url, | 120 chrome_browser_net::AppendQueryParameter(document_url, |
119 "exportFormat", | 121 "exportFormat", |
120 GetExportFormatParam(format)), | 122 GetExportFormatParam(format)), |
121 callback); | 123 callback); |
122 } | 124 } |
123 | 125 |
124 void DocumentsService::DownloadFile(const FilePath& virtual_path, | 126 void DocumentsService::DownloadFile(const FilePath& virtual_path, |
| 127 const FilePath& local_cache_path, |
125 const GURL& document_url, | 128 const GURL& document_url, |
126 const DownloadActionCallback& callback) { | 129 const DownloadActionCallback& callback) { |
127 StartOperationOnUIThread( | 130 StartOperationOnUIThread( |
128 new DownloadFileOperation(operation_registry_.get(), profile_, callback, | 131 new DownloadFileOperation(operation_registry_.get(), profile_, callback, |
129 document_url, virtual_path)); | 132 document_url, virtual_path, local_cache_path)); |
130 } | 133 } |
131 | 134 |
132 void DocumentsService::DeleteDocument(const GURL& document_url, | 135 void DocumentsService::DeleteDocument(const GURL& document_url, |
133 const EntryActionCallback& callback) { | 136 const EntryActionCallback& callback) { |
134 StartOperationOnUIThread( | 137 StartOperationOnUIThread( |
135 new DeleteDocumentOperation(operation_registry_.get(), profile_, callback, | 138 new DeleteDocumentOperation(operation_registry_.get(), profile_, callback, |
136 document_url)); | 139 document_url)); |
137 } | 140 } |
138 | 141 |
139 void DocumentsService::CreateDirectory( | 142 void DocumentsService::CreateDirectory( |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 void DocumentsService::RetryOperation(GDataOperationInterface* operation) { | 262 void DocumentsService::RetryOperation(GDataOperationInterface* operation) { |
260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 263 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
261 | 264 |
262 gdata_auth_service_->ClearOAuth2Token(); | 265 gdata_auth_service_->ClearOAuth2Token(); |
263 // User authentication might have expired - rerun the request to force | 266 // User authentication might have expired - rerun the request to force |
264 // auth token refresh. | 267 // auth token refresh. |
265 StartOperation(operation); | 268 StartOperation(operation); |
266 } | 269 } |
267 | 270 |
268 } // namespace gdata | 271 } // namespace gdata |
OLD | NEW |