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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop_proxy.h" | 14 #include "base/message_loop_proxy.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" |
17 #include "chrome/browser/chromeos/gdata/gdata_params.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_params.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h" | 19 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h" |
20 #include "chrome/common/net/gaia/oauth2_access_token_fetcher.h" | 20 #include "chrome/common/net/gaia/oauth2_access_token_fetcher.h" |
21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
22 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
23 #include "net/http/http_response_headers.h" | 23 #include "net/http/http_response_headers.h" |
| 24 #include "net/url_request/url_fetcher.h" |
24 | 25 |
25 namespace gdata { | 26 namespace gdata { |
26 | 27 |
27 //================================ AuthOperation =============================== | 28 //================================ AuthOperation =============================== |
28 | 29 |
29 // OAuth2 authorization token retrieval operation. | 30 // OAuth2 authorization token retrieval operation. |
30 class AuthOperation : public GDataOperationRegistry::Operation, | 31 class AuthOperation : public GDataOperationRegistry::Operation, |
31 public OAuth2AccessTokenConsumer { | 32 public OAuth2AccessTokenConsumer { |
32 public: | 33 public: |
33 AuthOperation(GDataOperationRegistry* registry, | 34 AuthOperation(GDataOperationRegistry* registry, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // an authentication failure. | 76 // an authentication failure. |
76 virtual void SetReAuthenticateCallback( | 77 virtual void SetReAuthenticateCallback( |
77 const ReAuthenticateCallback& callback) = 0; | 78 const ReAuthenticateCallback& callback) = 0; |
78 }; | 79 }; |
79 | 80 |
80 //============================ UrlFetchOperationBase =========================== | 81 //============================ UrlFetchOperationBase =========================== |
81 | 82 |
82 // Base class for operations that are fetching URLs. | 83 // Base class for operations that are fetching URLs. |
83 class UrlFetchOperationBase : public GDataOperationInterface, | 84 class UrlFetchOperationBase : public GDataOperationInterface, |
84 public GDataOperationRegistry::Operation, | 85 public GDataOperationRegistry::Operation, |
85 public content::URLFetcherDelegate { | 86 public net::URLFetcherDelegate { |
86 public: | 87 public: |
87 // Overridden from GDataOperationInterface. | 88 // Overridden from GDataOperationInterface. |
88 virtual void Start(const std::string& auth_token) OVERRIDE; | 89 virtual void Start(const std::string& auth_token) OVERRIDE; |
89 | 90 |
90 // Overridden from GDataOperationInterface. | 91 // Overridden from GDataOperationInterface. |
91 virtual void SetReAuthenticateCallback( | 92 virtual void SetReAuthenticateCallback( |
92 const ReAuthenticateCallback& callback) OVERRIDE; | 93 const ReAuthenticateCallback& callback) OVERRIDE; |
93 | 94 |
94 protected: | 95 protected: |
95 UrlFetchOperationBase(GDataOperationRegistry* registry, Profile* profile); | 96 UrlFetchOperationBase(GDataOperationRegistry* registry, Profile* profile); |
96 UrlFetchOperationBase(GDataOperationRegistry* registry, | 97 UrlFetchOperationBase(GDataOperationRegistry* registry, |
97 GDataOperationRegistry::OperationType type, | 98 GDataOperationRegistry::OperationType type, |
98 const FilePath& path, | 99 const FilePath& path, |
99 Profile* profile); | 100 Profile* profile); |
100 virtual ~UrlFetchOperationBase(); | 101 virtual ~UrlFetchOperationBase(); |
101 | 102 |
102 // Gets URL for the request. | 103 // Gets URL for the request. |
103 virtual GURL GetURL() const = 0; | 104 virtual GURL GetURL() const = 0; |
104 // Returns the request type. A derived class should override this method | 105 // Returns the request type. A derived class should override this method |
105 // for a request type other than HTTP GET. | 106 // for a request type other than HTTP GET. |
106 virtual content::URLFetcher::RequestType GetRequestType() const; | 107 virtual net::URLFetcher::RequestType GetRequestType() const; |
107 // Returns the extra HTTP headers for the request. A derived class should | 108 // Returns the extra HTTP headers for the request. A derived class should |
108 // override this method to specify any extra headers needed for the request. | 109 // override this method to specify any extra headers needed for the request. |
109 virtual std::vector<std::string> GetExtraRequestHeaders() const; | 110 virtual std::vector<std::string> GetExtraRequestHeaders() const; |
110 // Used by a derived class to add any content data to the request. | 111 // Used by a derived class to add any content data to the request. |
111 // Returns true if |upload_content_type| and |upload_content| are updated | 112 // Returns true if |upload_content_type| and |upload_content| are updated |
112 // with the content type and data for the request. | 113 // with the content type and data for the request. |
113 virtual bool GetContentData(std::string* upload_content_type, | 114 virtual bool GetContentData(std::string* upload_content_type, |
114 std::string* upload_content); | 115 std::string* upload_content); |
115 | 116 |
116 // Invoked by OnURLFetchComplete when the operation completes without an | 117 // Invoked by OnURLFetchComplete when the operation completes without an |
(...skipping 20 matching lines...) Expand all Loading... |
137 virtual void OnAuthFailed(GDataErrorCode code) OVERRIDE; | 138 virtual void OnAuthFailed(GDataErrorCode code) OVERRIDE; |
138 | 139 |
139 std::string GetResponseHeadersAsString( | 140 std::string GetResponseHeadersAsString( |
140 const net::URLFetcher* url_fetcher); | 141 const net::URLFetcher* url_fetcher); |
141 | 142 |
142 Profile* profile_; | 143 Profile* profile_; |
143 ReAuthenticateCallback re_authenticate_callback_; | 144 ReAuthenticateCallback re_authenticate_callback_; |
144 int re_authenticate_count_; | 145 int re_authenticate_count_; |
145 bool save_temp_file_; | 146 bool save_temp_file_; |
146 FilePath output_file_path_; | 147 FilePath output_file_path_; |
147 scoped_ptr<content::URLFetcher> url_fetcher_; | 148 scoped_ptr<net::URLFetcher> url_fetcher_; |
148 bool started_; | 149 bool started_; |
149 }; | 150 }; |
150 | 151 |
151 //============================ EntryActionOperation ============================ | 152 //============================ EntryActionOperation ============================ |
152 | 153 |
153 // This class performs a simple action over a given entry (document/file). | 154 // This class performs a simple action over a given entry (document/file). |
154 // It is meant to be used for operations that return no JSON blobs. | 155 // It is meant to be used for operations that return no JSON blobs. |
155 class EntryActionOperation : public UrlFetchOperationBase { | 156 class EntryActionOperation : public UrlFetchOperationBase { |
156 public: | 157 public: |
157 EntryActionOperation(GDataOperationRegistry* registry, | 158 EntryActionOperation(GDataOperationRegistry* registry, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 const FilePath& output_file_path); | 264 const FilePath& output_file_path); |
264 virtual ~DownloadFileOperation(); | 265 virtual ~DownloadFileOperation(); |
265 | 266 |
266 protected: | 267 protected: |
267 // Overridden from UrlFetchOperationBase. | 268 // Overridden from UrlFetchOperationBase. |
268 virtual GURL GetURL() const OVERRIDE; | 269 virtual GURL GetURL() const OVERRIDE; |
269 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) | 270 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) |
270 OVERRIDE; | 271 OVERRIDE; |
271 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 272 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
272 | 273 |
273 // Overridden from content::URLFetcherDelegate. | 274 // Overridden from net::URLFetcherDelegate. |
274 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, | 275 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, |
275 int64 current, int64 total) OVERRIDE; | 276 int64 current, int64 total) OVERRIDE; |
276 virtual bool ShouldSendDownloadData() OVERRIDE; | 277 virtual bool ShouldSendDownloadData() OVERRIDE; |
277 virtual void OnURLFetchDownloadData( | 278 virtual void OnURLFetchDownloadData( |
278 const net::URLFetcher* source, | 279 const net::URLFetcher* source, |
279 scoped_ptr<std::string> download_data) OVERRIDE; | 280 scoped_ptr<std::string> download_data) OVERRIDE; |
280 | 281 |
281 private: | 282 private: |
282 DownloadActionCallback download_action_callback_; | 283 DownloadActionCallback download_action_callback_; |
283 GetDownloadDataCallback get_download_data_callback_; | 284 GetDownloadDataCallback get_download_data_callback_; |
284 GURL document_url_; | 285 GURL document_url_; |
285 | 286 |
286 DISALLOW_COPY_AND_ASSIGN(DownloadFileOperation); | 287 DISALLOW_COPY_AND_ASSIGN(DownloadFileOperation); |
287 }; | 288 }; |
288 | 289 |
289 //=========================== DeleteDocumentOperation ========================== | 290 //=========================== DeleteDocumentOperation ========================== |
290 | 291 |
291 // This class performs the operation for deleting a document. | 292 // This class performs the operation for deleting a document. |
292 class DeleteDocumentOperation : public EntryActionOperation { | 293 class DeleteDocumentOperation : public EntryActionOperation { |
293 public: | 294 public: |
294 DeleteDocumentOperation(GDataOperationRegistry* registry, | 295 DeleteDocumentOperation(GDataOperationRegistry* registry, |
295 Profile* profile, | 296 Profile* profile, |
296 const EntryActionCallback& callback, | 297 const EntryActionCallback& callback, |
297 const GURL& document_url); | 298 const GURL& document_url); |
298 virtual ~DeleteDocumentOperation(); | 299 virtual ~DeleteDocumentOperation(); |
299 | 300 |
300 protected: | 301 protected: |
301 // Overridden from EntryActionOperation. | 302 // Overridden from EntryActionOperation. |
302 virtual content::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 303 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
303 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 304 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
304 | 305 |
305 private: | 306 private: |
306 DISALLOW_COPY_AND_ASSIGN(DeleteDocumentOperation); | 307 DISALLOW_COPY_AND_ASSIGN(DeleteDocumentOperation); |
307 }; | 308 }; |
308 | 309 |
309 //========================== CreateDirectoryOperation ========================== | 310 //========================== CreateDirectoryOperation ========================== |
310 | 311 |
311 // This class performs the operation for creating a directory. | 312 // This class performs the operation for creating a directory. |
312 class CreateDirectoryOperation : public GetDataOperation { | 313 class CreateDirectoryOperation : public GetDataOperation { |
313 public: | 314 public: |
314 // Empty |parent_content_url| will create the directory in the root folder. | 315 // Empty |parent_content_url| will create the directory in the root folder. |
315 CreateDirectoryOperation(GDataOperationRegistry* registry, | 316 CreateDirectoryOperation(GDataOperationRegistry* registry, |
316 Profile* profile, | 317 Profile* profile, |
317 const GetDataCallback& callback, | 318 const GetDataCallback& callback, |
318 const GURL& parent_content_url, | 319 const GURL& parent_content_url, |
319 const FilePath::StringType& directory_name); | 320 const FilePath::StringType& directory_name); |
320 virtual ~CreateDirectoryOperation(); | 321 virtual ~CreateDirectoryOperation(); |
321 | 322 |
322 protected: | 323 protected: |
323 // Overridden from UrlFetchOperationBase. | 324 // Overridden from UrlFetchOperationBase. |
324 virtual GURL GetURL() const OVERRIDE; | 325 virtual GURL GetURL() const OVERRIDE; |
325 virtual content::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 326 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
326 | 327 |
327 // Overridden from UrlFetchOperationBase. | 328 // Overridden from UrlFetchOperationBase. |
328 virtual bool GetContentData(std::string* upload_content_type, | 329 virtual bool GetContentData(std::string* upload_content_type, |
329 std::string* upload_content) OVERRIDE; | 330 std::string* upload_content) OVERRIDE; |
330 | 331 |
331 private: | 332 private: |
332 GURL parent_content_url_; | 333 GURL parent_content_url_; |
333 FilePath::StringType directory_name_; | 334 FilePath::StringType directory_name_; |
334 | 335 |
335 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); | 336 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); |
336 }; | 337 }; |
337 | 338 |
338 //============================ CopyDocumentOperation =========================== | 339 //============================ CopyDocumentOperation =========================== |
339 | 340 |
340 // This class performs the operation for making a copy of a document. | 341 // This class performs the operation for making a copy of a document. |
341 class CopyDocumentOperation : public GetDataOperation { | 342 class CopyDocumentOperation : public GetDataOperation { |
342 public: | 343 public: |
343 CopyDocumentOperation(GDataOperationRegistry* registry, | 344 CopyDocumentOperation(GDataOperationRegistry* registry, |
344 Profile* profile, | 345 Profile* profile, |
345 const GetDataCallback& callback, | 346 const GetDataCallback& callback, |
346 const std::string& resource_id, | 347 const std::string& resource_id, |
347 const FilePath::StringType& new_name); | 348 const FilePath::StringType& new_name); |
348 virtual ~CopyDocumentOperation(); | 349 virtual ~CopyDocumentOperation(); |
349 | 350 |
350 protected: | 351 protected: |
351 // Overridden from GetDataOperation. | 352 // Overridden from GetDataOperation. |
352 virtual content::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 353 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
353 | 354 |
354 // Overridden from UrlFetchOperationBase. | 355 // Overridden from UrlFetchOperationBase. |
355 virtual GURL GetURL() const OVERRIDE; | 356 virtual GURL GetURL() const OVERRIDE; |
356 virtual bool GetContentData(std::string* upload_content_type, | 357 virtual bool GetContentData(std::string* upload_content_type, |
357 std::string* upload_content) OVERRIDE; | 358 std::string* upload_content) OVERRIDE; |
358 | 359 |
359 private: | 360 private: |
360 std::string resource_id_; | 361 std::string resource_id_; |
361 FilePath::StringType new_name_; | 362 FilePath::StringType new_name_; |
362 | 363 |
363 DISALLOW_COPY_AND_ASSIGN(CopyDocumentOperation); | 364 DISALLOW_COPY_AND_ASSIGN(CopyDocumentOperation); |
364 }; | 365 }; |
365 | 366 |
366 //=========================== RenameResourceOperation ========================== | 367 //=========================== RenameResourceOperation ========================== |
367 | 368 |
368 // This class performs the operation for renaming a document/file/directory. | 369 // This class performs the operation for renaming a document/file/directory. |
369 class RenameResourceOperation : public EntryActionOperation { | 370 class RenameResourceOperation : public EntryActionOperation { |
370 public: | 371 public: |
371 RenameResourceOperation(GDataOperationRegistry* registry, | 372 RenameResourceOperation(GDataOperationRegistry* registry, |
372 Profile* profile, | 373 Profile* profile, |
373 const EntryActionCallback& callback, | 374 const EntryActionCallback& callback, |
374 const GURL& document_url, | 375 const GURL& document_url, |
375 const FilePath::StringType& new_name); | 376 const FilePath::StringType& new_name); |
376 virtual ~RenameResourceOperation(); | 377 virtual ~RenameResourceOperation(); |
377 | 378 |
378 protected: | 379 protected: |
379 // Overridden from EntryActionOperation. | 380 // Overridden from EntryActionOperation. |
380 virtual content::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 381 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
381 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 382 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
382 | 383 |
383 // Overridden from UrlFetchOperationBase. | 384 // Overridden from UrlFetchOperationBase. |
384 virtual bool GetContentData(std::string* upload_content_type, | 385 virtual bool GetContentData(std::string* upload_content_type, |
385 std::string* upload_content) OVERRIDE; | 386 std::string* upload_content) OVERRIDE; |
386 | 387 |
387 private: | 388 private: |
388 FilePath::StringType new_name_; | 389 FilePath::StringType new_name_; |
389 | 390 |
390 DISALLOW_COPY_AND_ASSIGN(RenameResourceOperation); | 391 DISALLOW_COPY_AND_ASSIGN(RenameResourceOperation); |
(...skipping 10 matching lines...) Expand all Loading... |
401 const EntryActionCallback& callback, | 402 const EntryActionCallback& callback, |
402 const GURL& parent_content_url, | 403 const GURL& parent_content_url, |
403 const GURL& document_url); | 404 const GURL& document_url); |
404 virtual ~AddResourceToDirectoryOperation(); | 405 virtual ~AddResourceToDirectoryOperation(); |
405 | 406 |
406 protected: | 407 protected: |
407 // Overridden from EntryActionOperation. | 408 // Overridden from EntryActionOperation. |
408 virtual GURL GetURL() const OVERRIDE; | 409 virtual GURL GetURL() const OVERRIDE; |
409 | 410 |
410 // Overridden from UrlFetchOperationBase. | 411 // Overridden from UrlFetchOperationBase. |
411 virtual content::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 412 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
412 virtual bool GetContentData(std::string* upload_content_type, | 413 virtual bool GetContentData(std::string* upload_content_type, |
413 std::string* upload_content) OVERRIDE; | 414 std::string* upload_content) OVERRIDE; |
414 | 415 |
415 private: | 416 private: |
416 GURL parent_content_url_; | 417 GURL parent_content_url_; |
417 | 418 |
418 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); | 419 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); |
419 }; | 420 }; |
420 | 421 |
421 //==================== RemoveResourceFromDirectoryOperation ==================== | 422 //==================== RemoveResourceFromDirectoryOperation ==================== |
422 | 423 |
423 // This class performs the operation for adding a document/file/directory | 424 // This class performs the operation for adding a document/file/directory |
424 // from a directory. | 425 // from a directory. |
425 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { | 426 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { |
426 public: | 427 public: |
427 RemoveResourceFromDirectoryOperation(GDataOperationRegistry* registry, | 428 RemoveResourceFromDirectoryOperation(GDataOperationRegistry* registry, |
428 Profile* profile, | 429 Profile* profile, |
429 const EntryActionCallback& callback, | 430 const EntryActionCallback& callback, |
430 const GURL& parent_content_url, | 431 const GURL& parent_content_url, |
431 const GURL& document_url, | 432 const GURL& document_url, |
432 const std::string& resource_id); | 433 const std::string& resource_id); |
433 virtual ~RemoveResourceFromDirectoryOperation(); | 434 virtual ~RemoveResourceFromDirectoryOperation(); |
434 | 435 |
435 protected: | 436 protected: |
436 // Overridden from EntryActionOperation. | 437 // Overridden from EntryActionOperation. |
437 virtual GURL GetURL() const OVERRIDE; | 438 virtual GURL GetURL() const OVERRIDE; |
438 | 439 |
439 // Overridden from UrlFetchOperationBase. | 440 // Overridden from UrlFetchOperationBase. |
440 virtual content::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 441 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
441 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 442 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
442 | 443 |
443 private: | 444 private: |
444 std::string resource_id_; | 445 std::string resource_id_; |
445 GURL parent_content_url_; | 446 GURL parent_content_url_; |
446 | 447 |
447 DISALLOW_COPY_AND_ASSIGN(RemoveResourceFromDirectoryOperation); | 448 DISALLOW_COPY_AND_ASSIGN(RemoveResourceFromDirectoryOperation); |
448 }; | 449 }; |
449 | 450 |
450 //=========================== InitiateUploadOperation ========================== | 451 //=========================== InitiateUploadOperation ========================== |
451 | 452 |
452 // This class performs the operation for initiating the upload of a file. | 453 // This class performs the operation for initiating the upload of a file. |
453 class InitiateUploadOperation : public UrlFetchOperationBase { | 454 class InitiateUploadOperation : public UrlFetchOperationBase { |
454 public: | 455 public: |
455 InitiateUploadOperation(GDataOperationRegistry* registry, | 456 InitiateUploadOperation(GDataOperationRegistry* registry, |
456 Profile* profile, | 457 Profile* profile, |
457 const InitiateUploadCallback& callback, | 458 const InitiateUploadCallback& callback, |
458 const InitiateUploadParams& params); | 459 const InitiateUploadParams& params); |
459 virtual ~InitiateUploadOperation(); | 460 virtual ~InitiateUploadOperation(); |
460 | 461 |
461 protected: | 462 protected: |
462 // Overridden from UrlFetchOperationBase. | 463 // Overridden from UrlFetchOperationBase. |
463 virtual GURL GetURL() const OVERRIDE; | 464 virtual GURL GetURL() const OVERRIDE; |
464 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) | 465 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) |
465 OVERRIDE; | 466 OVERRIDE; |
466 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | 467 virtual void NotifySuccessToOperationRegistry() OVERRIDE; |
467 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 468 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
468 | 469 |
469 // Overridden from UrlFetchOperationBase. | 470 // Overridden from UrlFetchOperationBase. |
470 virtual content::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 471 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
471 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 472 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
472 virtual bool GetContentData(std::string* upload_content_type, | 473 virtual bool GetContentData(std::string* upload_content_type, |
473 std::string* upload_content) OVERRIDE; | 474 std::string* upload_content) OVERRIDE; |
474 | 475 |
475 private: | 476 private: |
476 InitiateUploadCallback callback_; | 477 InitiateUploadCallback callback_; |
477 InitiateUploadParams params_; | 478 InitiateUploadParams params_; |
478 GURL initiate_upload_url_; | 479 GURL initiate_upload_url_; |
479 | 480 |
480 DISALLOW_COPY_AND_ASSIGN(InitiateUploadOperation); | 481 DISALLOW_COPY_AND_ASSIGN(InitiateUploadOperation); |
(...skipping 13 matching lines...) Expand all Loading... |
494 protected: | 495 protected: |
495 // Overridden from UrlFetchOperationBase. | 496 // Overridden from UrlFetchOperationBase. |
496 virtual GURL GetURL() const OVERRIDE; | 497 virtual GURL GetURL() const OVERRIDE; |
497 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) | 498 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) |
498 OVERRIDE; | 499 OVERRIDE; |
499 virtual void NotifyStartToOperationRegistry() OVERRIDE; | 500 virtual void NotifyStartToOperationRegistry() OVERRIDE; |
500 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | 501 virtual void NotifySuccessToOperationRegistry() OVERRIDE; |
501 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 502 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
502 | 503 |
503 // Overridden from UrlFetchOperationBase. | 504 // Overridden from UrlFetchOperationBase. |
504 virtual content::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 505 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
505 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 506 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
506 virtual bool GetContentData(std::string* upload_content_type, | 507 virtual bool GetContentData(std::string* upload_content_type, |
507 std::string* upload_content) OVERRIDE; | 508 std::string* upload_content) OVERRIDE; |
508 | 509 |
509 // Overridden from content::UrlFetcherDelegate | 510 // Overridden from content::UrlFetcherDelegate |
510 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, | 511 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, |
511 int64 current, int64 total) OVERRIDE; | 512 int64 current, int64 total) OVERRIDE; |
512 | 513 |
513 private: | 514 private: |
514 ResumeUploadCallback callback_; | 515 ResumeUploadCallback callback_; |
515 ResumeUploadParams params_; | 516 ResumeUploadParams params_; |
516 bool last_chunk_completed_; | 517 bool last_chunk_completed_; |
517 | 518 |
518 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); | 519 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); |
519 }; | 520 }; |
520 | 521 |
521 } // namespace gdata | 522 } // namespace gdata |
522 | 523 |
523 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 524 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
OLD | NEW |