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/google_apis/gdata_wapi_service.h" | 5 #include "chrome/browser/google_apis/gdata_wapi_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" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
12 #include "base/task_runner_util.h" | 12 #include "base/task_runner_util.h" |
13 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/google_apis/auth_service.h" | 15 #include "chrome/browser/google_apis/auth_service.h" |
16 #include "chrome/browser/google_apis/gdata_wapi_operations.h" | 16 #include "chrome/browser/google_apis/gdata_wapi_operations.h" |
17 #include "chrome/browser/google_apis/gdata_wapi_parser.h" | 17 #include "chrome/browser/google_apis/gdata_wapi_parser.h" |
18 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 18 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
19 #include "chrome/browser/google_apis/operation_runner.h" | 19 #include "chrome/browser/google_apis/operation_runner.h" |
20 #include "chrome/browser/google_apis/time_util.h" | 20 #include "chrome/browser/google_apis/time_util.h" |
21 #include "chrome/common/net/url_util.h" | |
22 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "net/base/url_util.h" |
23 | 23 |
24 using content::BrowserThread; | 24 using content::BrowserThread; |
25 | 25 |
26 namespace google_apis { | 26 namespace google_apis { |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 const char* GetExportFormatParam(DocumentExportFormat format) { | 30 const char* GetExportFormatParam(DocumentExportFormat format) { |
31 switch (format) { | 31 switch (format) { |
32 case PNG: | 32 case PNG: |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 const FilePath& local_cache_path, | 330 const FilePath& local_cache_path, |
331 const GURL& edit_url, | 331 const GURL& edit_url, |
332 DocumentExportFormat format, | 332 DocumentExportFormat format, |
333 const DownloadActionCallback& callback) { | 333 const DownloadActionCallback& callback) { |
334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
335 DCHECK(!callback.is_null()); | 335 DCHECK(!callback.is_null()); |
336 | 336 |
337 DownloadFile( | 337 DownloadFile( |
338 virtual_path, | 338 virtual_path, |
339 local_cache_path, | 339 local_cache_path, |
340 chrome_common_net::AppendQueryParameter(edit_url, | 340 net::AppendQueryParameter(edit_url, |
341 "exportFormat", | 341 "exportFormat", |
342 GetExportFormatParam(format)), | 342 GetExportFormatParam(format)), |
343 callback, | 343 callback, |
344 GetContentCallback()); | 344 GetContentCallback()); |
345 } | 345 } |
346 | 346 |
347 void GDataWapiService::DownloadFile( | 347 void GDataWapiService::DownloadFile( |
348 const FilePath& virtual_path, | 348 const FilePath& virtual_path, |
349 const FilePath& local_cache_path, | 349 const FilePath& local_cache_path, |
350 const GURL& content_url, | 350 const GURL& content_url, |
351 const DownloadActionCallback& download_action_callback, | 351 const DownloadActionCallback& download_action_callback, |
352 const GetContentCallback& get_content_callback) { | 352 const GetContentCallback& get_content_callback) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 DriveServiceObserver, observers_, OnProgressUpdate(list)); | 535 DriveServiceObserver, observers_, OnProgressUpdate(list)); |
536 } | 536 } |
537 | 537 |
538 void GDataWapiService::OnAuthenticationFailed(GDataErrorCode error) { | 538 void GDataWapiService::OnAuthenticationFailed(GDataErrorCode error) { |
539 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 539 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
540 FOR_EACH_OBSERVER( | 540 FOR_EACH_OBSERVER( |
541 DriveServiceObserver, observers_, OnAuthenticationFailed(error)); | 541 DriveServiceObserver, observers_, OnAuthenticationFailed(error)); |
542 } | 542 } |
543 | 543 |
544 } // namespace google_apis | 544 } // namespace google_apis |
OLD | NEW |