| 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 #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ | 5 #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ |
| 6 #define GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ | 6 #define GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | |
| 10 #include <string> | 9 #include <string> |
| 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/sequenced_task_runner.h" | 17 #include "base/sequenced_task_runner.h" |
| 18 #include "base/task_runner_util.h" | 18 #include "base/task_runner_util.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // Parses the |json| string by using DataType::CreateFrom. | 162 // Parses the |json| string by using DataType::CreateFrom. |
| 163 static scoped_ptr<DataType> Parse(const std::string& json) { | 163 static scoped_ptr<DataType> Parse(const std::string& json) { |
| 164 scoped_ptr<base::Value> value = ParseJson(json); | 164 scoped_ptr<base::Value> value = ParseJson(json); |
| 165 return value ? DataType::CreateFrom(*value) : scoped_ptr<DataType>(); | 165 return value ? DataType::CreateFrom(*value) : scoped_ptr<DataType>(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 // Receives the parsed result and invokes the callback. | 168 // Receives the parsed result and invokes the callback. |
| 169 void OnDataParsed(DriveApiErrorCode error, scoped_ptr<DataType> value) { | 169 void OnDataParsed(DriveApiErrorCode error, scoped_ptr<DataType> value) { |
| 170 if (!value) | 170 if (!value) |
| 171 error = DRIVE_PARSE_ERROR; | 171 error = DRIVE_PARSE_ERROR; |
| 172 callback_.Run(error, value.Pass()); | 172 callback_.Run(error, std::move(value)); |
| 173 OnProcessURLFetchResultsComplete(); | 173 OnProcessURLFetchResultsComplete(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 const Callback callback_; | 176 const Callback callback_; |
| 177 | 177 |
| 178 // Note: This should remain the last member so it'll be destroyed and | 178 // Note: This should remain the last member so it'll be destroyed and |
| 179 // invalidate its weak pointers before any other members are destroyed. | 179 // invalidate its weak pointers before any other members are destroyed. |
| 180 base::WeakPtrFactory<DriveApiDataRequest> weak_ptr_factory_; | 180 base::WeakPtrFactory<DriveApiDataRequest> weak_ptr_factory_; |
| 181 | 181 |
| 182 DISALLOW_COPY_AND_ASSIGN(DriveApiDataRequest); | 182 DISALLOW_COPY_AND_ASSIGN(DriveApiDataRequest); |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 // invalidate its weak pointers before any other members are destroyed. | 1255 // invalidate its weak pointers before any other members are destroyed. |
| 1256 base::WeakPtrFactory<BatchUploadRequest> weak_ptr_factory_; | 1256 base::WeakPtrFactory<BatchUploadRequest> weak_ptr_factory_; |
| 1257 | 1257 |
| 1258 DISALLOW_COPY_AND_ASSIGN(BatchUploadRequest); | 1258 DISALLOW_COPY_AND_ASSIGN(BatchUploadRequest); |
| 1259 }; | 1259 }; |
| 1260 | 1260 |
| 1261 } // namespace drive | 1261 } // namespace drive |
| 1262 } // namespace google_apis | 1262 } // namespace google_apis |
| 1263 | 1263 |
| 1264 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ | 1264 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ |
| OLD | NEW |