| 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 CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" |
| 10 #include "chrome/browser/google_apis/base_operations.h" | 11 #include "chrome/browser/google_apis/base_operations.h" |
| 11 #include "chrome/browser/google_apis/drive_api_url_generator.h" | 12 #include "chrome/browser/google_apis/drive_api_url_generator.h" |
| 12 #include "chrome/browser/google_apis/drive_service_interface.h" | 13 #include "chrome/browser/google_apis/drive_service_interface.h" |
| 13 | 14 |
| 14 namespace net { | 15 namespace net { |
| 15 class URLRequestContextGetter; | 16 class URLRequestContextGetter; |
| 16 } // namespace net | 17 } // namespace net |
| 17 | 18 |
| 18 namespace google_apis { | 19 namespace google_apis { |
| 19 | 20 |
| 21 class FileResource; |
| 22 |
| 23 // Callback used for operations that the server returns FileResource data |
| 24 // formatted into JSON value. |
| 25 typedef base::Callback<void(GDataErrorCode error, |
| 26 scoped_ptr<FileResource> entry)> |
| 27 FileResourceCallback; |
| 28 |
| 29 |
| 20 //============================== GetAboutOperation ============================= | 30 //============================== GetAboutOperation ============================= |
| 21 | 31 |
| 22 // This class performs the operation for fetching About data. | 32 // This class performs the operation for fetching About data. |
| 23 class GetAboutOperation : public GetDataOperation { | 33 class GetAboutOperation : public GetDataOperation { |
| 24 public: | 34 public: |
| 25 GetAboutOperation(OperationRegistry* registry, | 35 GetAboutOperation(OperationRegistry* registry, |
| 26 net::URLRequestContextGetter* url_request_context_getter, | 36 net::URLRequestContextGetter* url_request_context_getter, |
| 27 const DriveApiUrlGenerator& url_generator, | 37 const DriveApiUrlGenerator& url_generator, |
| 28 const GetAboutResourceCallback& callback); | 38 const GetAboutResourceCallback& callback); |
| 29 virtual ~GetAboutOperation(); | 39 virtual ~GetAboutOperation(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 128 |
| 119 //=============================== GetFlieOperation ============================= | 129 //=============================== GetFlieOperation ============================= |
| 120 | 130 |
| 121 // This class performs the operation for fetching a file. | 131 // This class performs the operation for fetching a file. |
| 122 class GetFileOperation : public GetDataOperation { | 132 class GetFileOperation : public GetDataOperation { |
| 123 public: | 133 public: |
| 124 GetFileOperation(OperationRegistry* registry, | 134 GetFileOperation(OperationRegistry* registry, |
| 125 net::URLRequestContextGetter* url_request_context_getter, | 135 net::URLRequestContextGetter* url_request_context_getter, |
| 126 const DriveApiUrlGenerator& url_generator, | 136 const DriveApiUrlGenerator& url_generator, |
| 127 const std::string& file_id, | 137 const std::string& file_id, |
| 128 const GetDataCallback& callback); | 138 const FileResourceCallback& callback); |
| 129 virtual ~GetFileOperation(); | 139 virtual ~GetFileOperation(); |
| 130 | 140 |
| 131 protected: | 141 protected: |
| 132 // Overridden from GetDataOperation. | 142 // Overridden from GetDataOperation. |
| 133 virtual GURL GetURL() const OVERRIDE; | 143 virtual GURL GetURL() const OVERRIDE; |
| 134 | 144 |
| 135 private: | 145 private: |
| 136 const DriveApiUrlGenerator url_generator_; | 146 const DriveApiUrlGenerator url_generator_; |
| 137 std::string file_id_; | 147 std::string file_id_; |
| 138 | 148 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 150 | 160 |
| 151 // This class performs the operation for creating a directory. | 161 // This class performs the operation for creating a directory. |
| 152 class CreateDirectoryOperation : public GetDataOperation { | 162 class CreateDirectoryOperation : public GetDataOperation { |
| 153 public: | 163 public: |
| 154 CreateDirectoryOperation( | 164 CreateDirectoryOperation( |
| 155 OperationRegistry* registry, | 165 OperationRegistry* registry, |
| 156 net::URLRequestContextGetter* url_request_context_getter, | 166 net::URLRequestContextGetter* url_request_context_getter, |
| 157 const DriveApiUrlGenerator& url_generator, | 167 const DriveApiUrlGenerator& url_generator, |
| 158 const std::string& parent_resource_id, | 168 const std::string& parent_resource_id, |
| 159 const std::string& directory_name, | 169 const std::string& directory_name, |
| 160 const GetDataCallback& callback); | 170 const FileResourceCallback& callback); |
| 161 virtual ~CreateDirectoryOperation(); | 171 virtual ~CreateDirectoryOperation(); |
| 162 | 172 |
| 163 protected: | 173 protected: |
| 164 // Overridden from GetDataOperation. | 174 // Overridden from GetDataOperation. |
| 165 virtual GURL GetURL() const OVERRIDE; | 175 virtual GURL GetURL() const OVERRIDE; |
| 166 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 176 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 167 virtual bool GetContentData(std::string* upload_content_type, | 177 virtual bool GetContentData(std::string* upload_content_type, |
| 168 std::string* upload_content) OVERRIDE; | 178 std::string* upload_content) OVERRIDE; |
| 169 | 179 |
| 170 private: | 180 private: |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 const std::string parent_resource_id_; | 315 const std::string parent_resource_id_; |
| 306 const std::string resource_id_; | 316 const std::string resource_id_; |
| 307 | 317 |
| 308 DISALLOW_COPY_AND_ASSIGN(DeleteResourceOperation); | 318 DISALLOW_COPY_AND_ASSIGN(DeleteResourceOperation); |
| 309 }; | 319 }; |
| 310 | 320 |
| 311 } // namespace drive | 321 } // namespace drive |
| 312 } // namespace google_apis | 322 } // namespace google_apis |
| 313 | 323 |
| 314 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ | 324 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ |
| OLD | NEW |