| 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_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const DownloadActionCallback& download_action_callback, | 93 const DownloadActionCallback& download_action_callback, |
| 94 const GetDownloadDataCallback& get_download_data_callback, | 94 const GetDownloadDataCallback& get_download_data_callback, |
| 95 const GURL& document_url, | 95 const GURL& document_url, |
| 96 const FilePath& virtual_path, | 96 const FilePath& virtual_path, |
| 97 const FilePath& output_file_path); | 97 const FilePath& output_file_path); |
| 98 virtual ~DownloadFileOperation(); | 98 virtual ~DownloadFileOperation(); |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 // Overridden from UrlFetchOperationBase. | 101 // Overridden from UrlFetchOperationBase. |
| 102 virtual GURL GetURL() const OVERRIDE; | 102 virtual GURL GetURL() const OVERRIDE; |
| 103 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 103 virtual void ProcessURLFetchResults( |
| 104 const net::URLFetcher* source, |
| 105 const ProcessURLFetchResultsCallBack& result_callback) OVERRIDE; |
| 104 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 106 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
| 105 | 107 |
| 106 // Overridden from net::URLFetcherDelegate. | 108 // Overridden from net::URLFetcherDelegate. |
| 107 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, | 109 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, |
| 108 int64 current, int64 total) OVERRIDE; | 110 int64 current, int64 total) OVERRIDE; |
| 109 virtual bool ShouldSendDownloadData() OVERRIDE; | 111 virtual bool ShouldSendDownloadData() OVERRIDE; |
| 110 virtual void OnURLFetchDownloadData( | 112 virtual void OnURLFetchDownloadData( |
| 111 const net::URLFetcher* source, | 113 const net::URLFetcher* source, |
| 112 scoped_ptr<std::string> download_data) OVERRIDE; | 114 scoped_ptr<std::string> download_data) OVERRIDE; |
| 113 | 115 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // Overridden from EntryActionOperation. | 244 // Overridden from EntryActionOperation. |
| 243 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 245 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 244 | 246 |
| 245 // Overridden from UrlFetchOperationBase. | 247 // Overridden from UrlFetchOperationBase. |
| 246 virtual bool GetContentData(std::string* upload_content_type, | 248 virtual bool GetContentData(std::string* upload_content_type, |
| 247 std::string* upload_content) OVERRIDE; | 249 std::string* upload_content) OVERRIDE; |
| 248 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 250 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
| 249 | 251 |
| 250 // Overridden from GetDataOperation. | 252 // Overridden from GetDataOperation. |
| 251 virtual GURL GetURL() const OVERRIDE; | 253 virtual GURL GetURL() const OVERRIDE; |
| 252 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 254 virtual void ProcessURLFetchResults( |
| 255 const net::URLFetcher* source, |
| 256 const ProcessURLFetchResultsCallBack& result_callback) OVERRIDE; |
| 253 | 257 |
| 254 // Must override GetDataOperation's ParseResponse because the response is XML | 258 // Must override GetDataOperation's ParseResponse because the response is XML |
| 255 // not JSON. | 259 // not JSON. |
| 256 virtual base::Value* ParseResponse(const std::string& data) OVERRIDE; | 260 virtual void ParseResponse( |
| 261 GDataErrorCode fetch_error_code, |
| 262 const std::string& data, |
| 263 const ProcessURLFetchResultsCallBack& result_callback) OVERRIDE; |
| 257 private: | 264 private: |
| 258 std::string app_id_; | 265 std::string app_id_; |
| 259 GURL document_url_; | 266 GURL document_url_; |
| 260 | 267 |
| 261 DISALLOW_COPY_AND_ASSIGN(AuthorizeAppsOperation); | 268 DISALLOW_COPY_AND_ASSIGN(AuthorizeAppsOperation); |
| 262 }; | 269 }; |
| 263 | 270 |
| 264 //======================= AddResourceToDirectoryOperation ====================== | 271 //======================= AddResourceToDirectoryOperation ====================== |
| 265 | 272 |
| 266 // This class performs the operation for adding a document/file/directory | 273 // This class performs the operation for adding a document/file/directory |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 public: | 328 public: |
| 322 InitiateUploadOperation(GDataOperationRegistry* registry, | 329 InitiateUploadOperation(GDataOperationRegistry* registry, |
| 323 Profile* profile, | 330 Profile* profile, |
| 324 const InitiateUploadCallback& callback, | 331 const InitiateUploadCallback& callback, |
| 325 const InitiateUploadParams& params); | 332 const InitiateUploadParams& params); |
| 326 virtual ~InitiateUploadOperation(); | 333 virtual ~InitiateUploadOperation(); |
| 327 | 334 |
| 328 protected: | 335 protected: |
| 329 // Overridden from UrlFetchOperationBase. | 336 // Overridden from UrlFetchOperationBase. |
| 330 virtual GURL GetURL() const OVERRIDE; | 337 virtual GURL GetURL() const OVERRIDE; |
| 331 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 338 virtual void ProcessURLFetchResults( |
| 339 const net::URLFetcher* source, |
| 340 const ProcessURLFetchResultsCallBack& result_callback) OVERRIDE; |
| 332 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | 341 virtual void NotifySuccessToOperationRegistry() OVERRIDE; |
| 333 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 342 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
| 334 | 343 |
| 335 // Overridden from UrlFetchOperationBase. | 344 // Overridden from UrlFetchOperationBase. |
| 336 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 345 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 337 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 346 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
| 338 virtual bool GetContentData(std::string* upload_content_type, | 347 virtual bool GetContentData(std::string* upload_content_type, |
| 339 std::string* upload_content) OVERRIDE; | 348 std::string* upload_content) OVERRIDE; |
| 340 | 349 |
| 341 private: | 350 private: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 353 public: | 362 public: |
| 354 ResumeUploadOperation(GDataOperationRegistry* registry, | 363 ResumeUploadOperation(GDataOperationRegistry* registry, |
| 355 Profile* profile, | 364 Profile* profile, |
| 356 const ResumeUploadCallback& callback, | 365 const ResumeUploadCallback& callback, |
| 357 const ResumeUploadParams& params); | 366 const ResumeUploadParams& params); |
| 358 virtual ~ResumeUploadOperation(); | 367 virtual ~ResumeUploadOperation(); |
| 359 | 368 |
| 360 protected: | 369 protected: |
| 361 // Overridden from UrlFetchOperationBase. | 370 // Overridden from UrlFetchOperationBase. |
| 362 virtual GURL GetURL() const OVERRIDE; | 371 virtual GURL GetURL() const OVERRIDE; |
| 363 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 372 virtual void ProcessURLFetchResults( |
| 373 const net::URLFetcher* source, |
| 374 const ProcessURLFetchResultsCallBack& result_callback) OVERRIDE; |
| 375 |
| 364 virtual void NotifyStartToOperationRegistry() OVERRIDE; | 376 virtual void NotifyStartToOperationRegistry() OVERRIDE; |
| 365 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | 377 virtual void NotifySuccessToOperationRegistry() OVERRIDE; |
| 366 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 378 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
| 367 | 379 |
| 368 // Overridden from UrlFetchOperationBase. | 380 // Overridden from UrlFetchOperationBase. |
| 369 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 381 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 370 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 382 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
| 371 virtual bool GetContentData(std::string* upload_content_type, | 383 virtual bool GetContentData(std::string* upload_content_type, |
| 372 std::string* upload_content) OVERRIDE; | 384 std::string* upload_content) OVERRIDE; |
| 373 | 385 |
| 374 // Overridden from content::UrlFetcherDelegate | 386 // Overridden from content::UrlFetcherDelegate |
| 375 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, | 387 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, |
| 376 int64 current, int64 total) OVERRIDE; | 388 int64 current, int64 total) OVERRIDE; |
| 377 | 389 |
| 378 private: | 390 private: |
| 379 ResumeUploadCallback callback_; | 391 ResumeUploadCallback callback_; |
| 380 ResumeUploadParams params_; | 392 ResumeUploadParams params_; |
| 381 bool last_chunk_completed_; | 393 bool last_chunk_completed_; |
| 382 | 394 |
| 383 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); | 395 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); |
| 384 }; | 396 }; |
| 385 | 397 |
| 386 } // namespace gdata | 398 } // namespace gdata |
| 387 | 399 |
| 388 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 400 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
| OLD | NEW |