| 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/drive_api_requests.h" | 5 #include "chrome/browser/google_apis/drive_api_requests.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/task_runner_util.h" | 11 #include "base/task_runner_util.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/google_apis/drive_api_parser.h" | 13 #include "chrome/browser/google_apis/drive_api_parser.h" |
| 14 #include "chrome/browser/google_apis/request_sender.h" | 14 #include "chrome/browser/google_apis/request_sender.h" |
| 15 #include "chrome/browser/google_apis/request_util.h" | 15 #include "chrome/browser/google_apis/request_util.h" |
| 16 #include "chrome/browser/google_apis/time_util.h" | 16 #include "chrome/browser/google_apis/time_util.h" |
| 17 #include "net/base/url_util.h" | 17 #include "net/base/url_util.h" |
| 18 | 18 |
| 19 namespace google_apis { | 19 namespace google_apis { |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 const char kContentTypeApplicationJson[] = "application/json"; | 22 const char kContentTypeApplicationJson[] = "application/json"; |
| 23 const char kDirectoryMimeType[] = "application/vnd.google-apps.folder"; | |
| 24 const char kParentLinkKind[] = "drive#fileLink"; | 23 const char kParentLinkKind[] = "drive#fileLink"; |
| 25 | 24 |
| 26 // Parses the JSON value to a resource typed |T| and runs |callback| on the UI | 25 // Parses the JSON value to a resource typed |T| and runs |callback| on the UI |
| 27 // thread once parsing is done. | 26 // thread once parsing is done. |
| 28 template<typename T> | 27 template<typename T> |
| 29 void ParseJsonAndRun( | 28 void ParseJsonAndRun( |
| 30 const base::Callback<void(GDataErrorCode, scoped_ptr<T>)>& callback, | 29 const base::Callback<void(GDataErrorCode, scoped_ptr<T>)>& callback, |
| 31 GDataErrorCode error, | 30 GDataErrorCode error, |
| 32 scoped_ptr<base::Value> value) { | 31 scoped_ptr<base::Value> value) { |
| 33 DCHECK(!callback.is_null()); | 32 DCHECK(!callback.is_null()); |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 progress_callback, | 705 progress_callback, |
| 707 url_generator.GenerateDownloadFileUrl(resource_id), | 706 url_generator.GenerateDownloadFileUrl(resource_id), |
| 708 output_file_path) { | 707 output_file_path) { |
| 709 } | 708 } |
| 710 | 709 |
| 711 DownloadFileRequest::~DownloadFileRequest() { | 710 DownloadFileRequest::~DownloadFileRequest() { |
| 712 } | 711 } |
| 713 | 712 |
| 714 } // namespace drive | 713 } // namespace drive |
| 715 } // namespace google_apis | 714 } // namespace google_apis |
| OLD | NEW |