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/drive/drive_api_service.h" | 5 #include "chrome/browser/chromeos/drive/drive_api_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 const GURL& url, | 211 const GURL& url, |
212 const std::string& search_query, | 212 const std::string& search_query, |
213 const google_apis::GetResourceListCallback& callback) { | 213 const google_apis::GetResourceListCallback& callback) { |
214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
215 DCHECK(!callback.is_null()); | 215 DCHECK(!callback.is_null()); |
216 | 216 |
217 runner_->StartOperationWithRetry( | 217 runner_->StartOperationWithRetry( |
218 new google_apis::GetFilelistOperation( | 218 new google_apis::GetFilelistOperation( |
219 operation_registry(), | 219 operation_registry(), |
220 url_request_context_getter_, | 220 url_request_context_getter_, |
| 221 url_generator_, |
221 url, | 222 url, |
222 search_query, | 223 search_query, |
223 base::Bind(&ParseResourceListAndRun, callback))); | 224 base::Bind(&ParseResourceListAndRun, callback))); |
224 } | 225 } |
225 | 226 |
226 void DriveAPIService::GetChangelist( | 227 void DriveAPIService::GetChangelist( |
227 const GURL& url, | 228 const GURL& url, |
228 int64 start_changestamp, | 229 int64 start_changestamp, |
229 const google_apis::GetResourceListCallback& callback) { | 230 const google_apis::GetResourceListCallback& callback) { |
230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
231 DCHECK(!callback.is_null()); | 232 DCHECK(!callback.is_null()); |
232 | 233 |
233 runner_->StartOperationWithRetry( | 234 runner_->StartOperationWithRetry( |
234 new google_apis::GetChangelistOperation( | 235 new google_apis::GetChangelistOperation( |
235 operation_registry(), | 236 operation_registry(), |
236 url_request_context_getter_, | 237 url_request_context_getter_, |
| 238 url_generator_, |
237 url, | 239 url, |
238 start_changestamp, | 240 start_changestamp, |
239 base::Bind(&ParseResourceListAndRun, callback))); | 241 base::Bind(&ParseResourceListAndRun, callback))); |
240 } | 242 } |
241 | 243 |
242 void DriveAPIService::GetResourceEntry( | 244 void DriveAPIService::GetResourceEntry( |
243 const std::string& resource_id, | 245 const std::string& resource_id, |
244 const google_apis::GetResourceEntryCallback& callback) { | 246 const google_apis::GetResourceEntryCallback& callback) { |
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
246 DCHECK(!callback.is_null()); | 248 DCHECK(!callback.is_null()); |
247 | 249 |
248 runner_->StartOperationWithRetry(new google_apis::GetFileOperation( | 250 runner_->StartOperationWithRetry(new google_apis::GetFileOperation( |
249 operation_registry(), | 251 operation_registry(), |
250 url_request_context_getter_, | 252 url_request_context_getter_, |
| 253 url_generator_, |
251 resource_id, | 254 resource_id, |
252 base::Bind(&ParseResourceEntryAndRun, callback))); | 255 base::Bind(&ParseResourceEntryAndRun, callback))); |
253 } | 256 } |
254 | 257 |
255 void DriveAPIService::GetAccountMetadata( | 258 void DriveAPIService::GetAccountMetadata( |
256 const google_apis::GetAccountMetadataCallback& callback) { | 259 const google_apis::GetAccountMetadataCallback& callback) { |
257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
258 DCHECK(!callback.is_null()); | 261 DCHECK(!callback.is_null()); |
259 | 262 |
260 runner_->StartOperationWithRetry( | 263 runner_->StartOperationWithRetry( |
261 new google_apis::GetAboutOperation( | 264 new google_apis::GetAboutOperation( |
262 operation_registry(), | 265 operation_registry(), |
263 url_request_context_getter_, | 266 url_request_context_getter_, |
| 267 url_generator_, |
264 base::Bind(&ParseAccounetMetadataAndRun, callback))); | 268 base::Bind(&ParseAccounetMetadataAndRun, callback))); |
265 } | 269 } |
266 | 270 |
267 void DriveAPIService::GetApplicationInfo( | 271 void DriveAPIService::GetApplicationInfo( |
268 const google_apis::GetDataCallback& callback) { | 272 const google_apis::GetDataCallback& callback) { |
269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
270 DCHECK(!callback.is_null()); | 274 DCHECK(!callback.is_null()); |
271 | 275 |
272 runner_->StartOperationWithRetry( | 276 runner_->StartOperationWithRetry( |
273 new google_apis::GetApplistOperation(operation_registry(), | 277 new google_apis::GetApplistOperation(operation_registry(), |
274 url_request_context_getter_, | 278 url_request_context_getter_, |
| 279 url_generator_, |
275 callback)); | 280 callback)); |
276 } | 281 } |
277 | 282 |
278 void DriveAPIService::DownloadHostedDocument( | 283 void DriveAPIService::DownloadHostedDocument( |
279 const FilePath& virtual_path, | 284 const FilePath& virtual_path, |
280 const FilePath& local_cache_path, | 285 const FilePath& local_cache_path, |
281 const GURL& content_url, | 286 const GURL& content_url, |
282 google_apis::DocumentExportFormat format, | 287 google_apis::DocumentExportFormat format, |
283 const google_apis::DownloadActionCallback& callback) { | 288 const google_apis::DownloadActionCallback& callback) { |
284 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 437 |
433 void DriveAPIService::OnAuthenticationFailed( | 438 void DriveAPIService::OnAuthenticationFailed( |
434 google_apis::GDataErrorCode error) { | 439 google_apis::GDataErrorCode error) { |
435 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 440 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
436 FOR_EACH_OBSERVER( | 441 FOR_EACH_OBSERVER( |
437 google_apis::DriveServiceObserver, observers_, | 442 google_apis::DriveServiceObserver, observers_, |
438 OnAuthenticationFailed(error)); | 443 OnAuthenticationFailed(error)); |
439 } | 444 } |
440 | 445 |
441 } // namespace drive | 446 } // namespace drive |
OLD | NEW |