| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "chrome/browser/chromeos/gdata/drive_upload_mode.h" | |
| 12 #include "chrome/browser/google_apis/operations_base.h" | |
| 13 #include "net/base/io_buffer.h" | |
| 14 | |
| 15 namespace gdata { | |
| 16 | |
| 17 class GDataEntry; | |
| 18 class DocumentEntry; | |
| 19 | |
| 20 //============================ GetDocumentsOperation =========================== | |
| 21 | |
| 22 // This class performs the operation for fetching a document list. | |
| 23 class GetDocumentsOperation : public GetDataOperation { | |
| 24 public: | |
| 25 // |start_changestamp| specifies the starting point of change list or 0 if | |
| 26 // all changes are necessary. | |
| 27 // |url| specifies URL for documents feed fetching operation. If empty URL is | |
| 28 // passed, the default URL is used and returns the first page of the result. | |
| 29 // When non-first page result is requested, |url| should be specified. | |
| 30 GetDocumentsOperation(OperationRegistry* registry, | |
| 31 const GURL& url, | |
| 32 int start_changestamp, | |
| 33 const std::string& search_string, | |
| 34 const std::string& directory_resource_id, | |
| 35 const GetDataCallback& callback); | |
| 36 virtual ~GetDocumentsOperation(); | |
| 37 | |
| 38 protected: | |
| 39 // Overridden from GetDataOperation. | |
| 40 virtual GURL GetURL() const OVERRIDE; | |
| 41 | |
| 42 private: | |
| 43 GURL override_url_; | |
| 44 int start_changestamp_; | |
| 45 std::string search_string_; | |
| 46 std::string directory_resource_id_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(GetDocumentsOperation); | |
| 49 }; | |
| 50 | |
| 51 //========================= GetDocumentEntryOperation ========================== | |
| 52 | |
| 53 // This class performs the operation for fetching a single document entry. | |
| 54 class GetDocumentEntryOperation : public GetDataOperation { | |
| 55 public: | |
| 56 GetDocumentEntryOperation(OperationRegistry* registry, | |
| 57 const std::string& resource_id, | |
| 58 const GetDataCallback& callback); | |
| 59 virtual ~GetDocumentEntryOperation(); | |
| 60 | |
| 61 protected: | |
| 62 // Overridden from GetGdataOperation. | |
| 63 virtual GURL GetURL() const OVERRIDE; | |
| 64 | |
| 65 private: | |
| 66 // Resource id of the requested entry. | |
| 67 std::string resource_id_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(GetDocumentEntryOperation); | |
| 70 }; | |
| 71 | |
| 72 //========================= GetAccountMetadataOperation ======================== | |
| 73 | |
| 74 // This class performs the operation for fetching account metadata. | |
| 75 class GetAccountMetadataOperation : public GetDataOperation { | |
| 76 public: | |
| 77 GetAccountMetadataOperation(OperationRegistry* registry, | |
| 78 const GetDataCallback& callback); | |
| 79 virtual ~GetAccountMetadataOperation(); | |
| 80 | |
| 81 protected: | |
| 82 // Overridden from GetDataOperation. | |
| 83 virtual GURL GetURL() const OVERRIDE; | |
| 84 | |
| 85 private: | |
| 86 DISALLOW_COPY_AND_ASSIGN(GetAccountMetadataOperation); | |
| 87 }; | |
| 88 | |
| 89 //============================ DownloadFileOperation =========================== | |
| 90 | |
| 91 // Callback type for DownloadDocument/DownloadFile DocumentServiceInterface | |
| 92 // calls. | |
| 93 typedef base::Callback<void(GDataErrorCode error, | |
| 94 const GURL& content_url, | |
| 95 const FilePath& temp_file)> DownloadActionCallback; | |
| 96 | |
| 97 // This class performs the operation for downloading of a given document/file. | |
| 98 class DownloadFileOperation : public UrlFetchOperationBase { | |
| 99 public: | |
| 100 DownloadFileOperation( | |
| 101 OperationRegistry* registry, | |
| 102 const DownloadActionCallback& download_action_callback, | |
| 103 const GetContentCallback& get_content_callback, | |
| 104 const GURL& document_url, | |
| 105 const FilePath& virtual_path, | |
| 106 const FilePath& output_file_path); | |
| 107 virtual ~DownloadFileOperation(); | |
| 108 | |
| 109 protected: | |
| 110 // Overridden from UrlFetchOperationBase. | |
| 111 virtual GURL GetURL() const OVERRIDE; | |
| 112 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | |
| 113 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | |
| 114 | |
| 115 // Overridden from net::URLFetcherDelegate. | |
| 116 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, | |
| 117 int64 current, int64 total) OVERRIDE; | |
| 118 virtual bool ShouldSendDownloadData() OVERRIDE; | |
| 119 virtual void OnURLFetchDownloadData( | |
| 120 const net::URLFetcher* source, | |
| 121 scoped_ptr<std::string> download_data) OVERRIDE; | |
| 122 | |
| 123 private: | |
| 124 DownloadActionCallback download_action_callback_; | |
| 125 GetContentCallback get_content_callback_; | |
| 126 GURL document_url_; | |
| 127 | |
| 128 DISALLOW_COPY_AND_ASSIGN(DownloadFileOperation); | |
| 129 }; | |
| 130 | |
| 131 //=========================== DeleteDocumentOperation ========================== | |
| 132 | |
| 133 // This class performs the operation for deleting a document. | |
| 134 class DeleteDocumentOperation : public EntryActionOperation { | |
| 135 public: | |
| 136 DeleteDocumentOperation(OperationRegistry* registry, | |
| 137 const EntryActionCallback& callback, | |
| 138 const GURL& document_url); | |
| 139 virtual ~DeleteDocumentOperation(); | |
| 140 | |
| 141 protected: | |
| 142 // Overridden from UrlFetchOperationBase. | |
| 143 virtual GURL GetURL() const OVERRIDE; | |
| 144 | |
| 145 // Overridden from EntryActionOperation. | |
| 146 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
| 147 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | |
| 148 | |
| 149 private: | |
| 150 DISALLOW_COPY_AND_ASSIGN(DeleteDocumentOperation); | |
| 151 }; | |
| 152 | |
| 153 //========================== CreateDirectoryOperation ========================== | |
| 154 | |
| 155 // This class performs the operation for creating a directory. | |
| 156 class CreateDirectoryOperation : public GetDataOperation { | |
| 157 public: | |
| 158 // Empty |parent_content_url| will create the directory in the root folder. | |
| 159 CreateDirectoryOperation(OperationRegistry* registry, | |
| 160 const GetDataCallback& callback, | |
| 161 const GURL& parent_content_url, | |
| 162 const FilePath::StringType& directory_name); | |
| 163 virtual ~CreateDirectoryOperation(); | |
| 164 | |
| 165 protected: | |
| 166 // Overridden from UrlFetchOperationBase. | |
| 167 virtual GURL GetURL() const OVERRIDE; | |
| 168 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
| 169 | |
| 170 // Overridden from UrlFetchOperationBase. | |
| 171 virtual bool GetContentData(std::string* upload_content_type, | |
| 172 std::string* upload_content) OVERRIDE; | |
| 173 | |
| 174 private: | |
| 175 GURL parent_content_url_; | |
| 176 FilePath::StringType directory_name_; | |
| 177 | |
| 178 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); | |
| 179 }; | |
| 180 | |
| 181 //============================ CopyDocumentOperation =========================== | |
| 182 | |
| 183 // This class performs the operation for making a copy of a document. | |
| 184 class CopyDocumentOperation : public GetDataOperation { | |
| 185 public: | |
| 186 CopyDocumentOperation(OperationRegistry* registry, | |
| 187 const GetDataCallback& callback, | |
| 188 const std::string& resource_id, | |
| 189 const FilePath::StringType& new_name); | |
| 190 virtual ~CopyDocumentOperation(); | |
| 191 | |
| 192 protected: | |
| 193 // Overridden from GetDataOperation. | |
| 194 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
| 195 | |
| 196 // Overridden from UrlFetchOperationBase. | |
| 197 virtual GURL GetURL() const OVERRIDE; | |
| 198 virtual bool GetContentData(std::string* upload_content_type, | |
| 199 std::string* upload_content) OVERRIDE; | |
| 200 | |
| 201 private: | |
| 202 std::string resource_id_; | |
| 203 FilePath::StringType new_name_; | |
| 204 | |
| 205 DISALLOW_COPY_AND_ASSIGN(CopyDocumentOperation); | |
| 206 }; | |
| 207 | |
| 208 //=========================== RenameResourceOperation ========================== | |
| 209 | |
| 210 // This class performs the operation for renaming a document/file/directory. | |
| 211 class RenameResourceOperation : public EntryActionOperation { | |
| 212 public: | |
| 213 RenameResourceOperation(OperationRegistry* registry, | |
| 214 const EntryActionCallback& callback, | |
| 215 const GURL& document_url, | |
| 216 const FilePath::StringType& new_name); | |
| 217 virtual ~RenameResourceOperation(); | |
| 218 | |
| 219 protected: | |
| 220 // Overridden from EntryActionOperation. | |
| 221 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
| 222 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | |
| 223 | |
| 224 // Overridden from UrlFetchOperationBase. | |
| 225 virtual GURL GetURL() const OVERRIDE; | |
| 226 virtual bool GetContentData(std::string* upload_content_type, | |
| 227 std::string* upload_content) OVERRIDE; | |
| 228 | |
| 229 private: | |
| 230 FilePath::StringType new_name_; | |
| 231 | |
| 232 DISALLOW_COPY_AND_ASSIGN(RenameResourceOperation); | |
| 233 }; | |
| 234 | |
| 235 //=========================== AuthorizeAppOperation ========================== | |
| 236 | |
| 237 // This class performs the operation for renaming a document/file/directory. | |
| 238 class AuthorizeAppsOperation : public GetDataOperation { | |
| 239 public: | |
| 240 AuthorizeAppsOperation(OperationRegistry* registry, | |
| 241 const GetDataCallback& callback, | |
| 242 const GURL& document_url, | |
| 243 const std::string& app_ids); | |
| 244 virtual ~AuthorizeAppsOperation(); | |
| 245 | |
| 246 protected: | |
| 247 // Overridden from EntryActionOperation. | |
| 248 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
| 249 | |
| 250 // Overridden from UrlFetchOperationBase. | |
| 251 virtual bool GetContentData(std::string* upload_content_type, | |
| 252 std::string* upload_content) OVERRIDE; | |
| 253 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | |
| 254 | |
| 255 // Overridden from GetDataOperation. | |
| 256 virtual GURL GetURL() const OVERRIDE; | |
| 257 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | |
| 258 | |
| 259 // Must override GetDataOperation's ParseResponse because the response is XML | |
| 260 // not JSON. | |
| 261 virtual void ParseResponse(GDataErrorCode fetch_error_code, | |
| 262 const std::string& data) OVERRIDE; | |
| 263 | |
| 264 private: | |
| 265 std::string app_id_; | |
| 266 GURL document_url_; | |
| 267 | |
| 268 DISALLOW_COPY_AND_ASSIGN(AuthorizeAppsOperation); | |
| 269 }; | |
| 270 | |
| 271 //======================= AddResourceToDirectoryOperation ====================== | |
| 272 | |
| 273 // This class performs the operation for adding a document/file/directory | |
| 274 // to a directory. | |
| 275 class AddResourceToDirectoryOperation : public EntryActionOperation { | |
| 276 public: | |
| 277 AddResourceToDirectoryOperation(OperationRegistry* registry, | |
| 278 const EntryActionCallback& callback, | |
| 279 const GURL& parent_content_url, | |
| 280 const GURL& document_url); | |
| 281 virtual ~AddResourceToDirectoryOperation(); | |
| 282 | |
| 283 protected: | |
| 284 // Overridden from UrlFetchOperationBase. | |
| 285 virtual GURL GetURL() const OVERRIDE; | |
| 286 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
| 287 virtual bool GetContentData(std::string* upload_content_type, | |
| 288 std::string* upload_content) OVERRIDE; | |
| 289 | |
| 290 private: | |
| 291 GURL parent_content_url_; | |
| 292 | |
| 293 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); | |
| 294 }; | |
| 295 | |
| 296 //==================== RemoveResourceFromDirectoryOperation ==================== | |
| 297 | |
| 298 // This class performs the operation for adding a document/file/directory | |
| 299 // from a directory. | |
| 300 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { | |
| 301 public: | |
| 302 RemoveResourceFromDirectoryOperation(OperationRegistry* registry, | |
| 303 const EntryActionCallback& callback, | |
| 304 const GURL& parent_content_url, | |
| 305 const GURL& document_url, | |
| 306 const std::string& resource_id); | |
| 307 virtual ~RemoveResourceFromDirectoryOperation(); | |
| 308 | |
| 309 protected: | |
| 310 // Overridden from UrlFetchOperationBase. | |
| 311 virtual GURL GetURL() const OVERRIDE; | |
| 312 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
| 313 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | |
| 314 | |
| 315 private: | |
| 316 std::string resource_id_; | |
| 317 GURL parent_content_url_; | |
| 318 | |
| 319 DISALLOW_COPY_AND_ASSIGN(RemoveResourceFromDirectoryOperation); | |
| 320 }; | |
| 321 | |
| 322 //=========================== InitiateUploadOperation ========================== | |
| 323 | |
| 324 // Struct for passing params needed for DriveServiceInterface::InitiateUpload() | |
| 325 // calls. | |
| 326 // | |
| 327 // When uploading a new file (UPLOAD_NEW_FILE): | |
| 328 // - |title| should be set. | |
| 329 // - |upload_location| should be the upload_url() of the parent directory. | |
| 330 // | |
| 331 // When updating an existing file (UPLOAD_EXISTING_FILE): | |
| 332 // - |title| should be empty | |
| 333 // - |upload_location| should be the upload_url() of the existing file. | |
| 334 struct InitiateUploadParams { | |
| 335 InitiateUploadParams(UploadMode upload_mode, | |
| 336 const std::string& title, | |
| 337 const std::string& content_type, | |
| 338 int64 content_length, | |
| 339 const GURL& upload_location, | |
| 340 const FilePath& virtual_path); | |
| 341 ~InitiateUploadParams(); | |
| 342 | |
| 343 UploadMode upload_mode; | |
| 344 std::string title; | |
| 345 std::string content_type; | |
| 346 int64 content_length; | |
| 347 GURL upload_location; | |
| 348 const FilePath& virtual_path; | |
| 349 }; | |
| 350 | |
| 351 // Callback type for DocumentServiceInterface::InitiateUpload. | |
| 352 typedef base::Callback<void(GDataErrorCode error, | |
| 353 const GURL& upload_url)> InitiateUploadCallback; | |
| 354 | |
| 355 // This class performs the operation for initiating the upload of a file. | |
| 356 class InitiateUploadOperation : public UrlFetchOperationBase { | |
| 357 public: | |
| 358 InitiateUploadOperation(OperationRegistry* registry, | |
| 359 const InitiateUploadCallback& callback, | |
| 360 const InitiateUploadParams& params); | |
| 361 virtual ~InitiateUploadOperation(); | |
| 362 | |
| 363 protected: | |
| 364 // Overridden from UrlFetchOperationBase. | |
| 365 virtual GURL GetURL() const OVERRIDE; | |
| 366 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | |
| 367 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | |
| 368 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | |
| 369 | |
| 370 // Overridden from UrlFetchOperationBase. | |
| 371 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
| 372 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | |
| 373 virtual bool GetContentData(std::string* upload_content_type, | |
| 374 std::string* upload_content) OVERRIDE; | |
| 375 | |
| 376 private: | |
| 377 InitiateUploadCallback callback_; | |
| 378 InitiateUploadParams params_; | |
| 379 GURL initiate_upload_url_; | |
| 380 | |
| 381 DISALLOW_COPY_AND_ASSIGN(InitiateUploadOperation); | |
| 382 }; | |
| 383 | |
| 384 //============================ ResumeUploadOperation =========================== | |
| 385 | |
| 386 // Struct for response to ResumeUpload. | |
| 387 struct ResumeUploadResponse { | |
| 388 ResumeUploadResponse(GDataErrorCode code, | |
| 389 int64 start_range_received, | |
| 390 int64 end_range_received); | |
| 391 ~ResumeUploadResponse(); | |
| 392 | |
| 393 GDataErrorCode code; | |
| 394 int64 start_range_received; | |
| 395 int64 end_range_received; | |
| 396 FilePath virtual_path; | |
| 397 }; | |
| 398 | |
| 399 // Struct for passing params needed for DriveServiceInterface::ResumeUpload() | |
| 400 // calls. | |
| 401 struct ResumeUploadParams { | |
| 402 ResumeUploadParams(UploadMode upload_mode, | |
| 403 int64 start_range, | |
| 404 int64 end_range, | |
| 405 int64 content_length, | |
| 406 const std::string& content_type, | |
| 407 scoped_refptr<net::IOBuffer> buf, | |
| 408 const GURL& upload_location, | |
| 409 const FilePath& virtual_path); | |
| 410 ~ResumeUploadParams(); | |
| 411 | |
| 412 UploadMode upload_mode; // Mode of the upload. | |
| 413 int64 start_range; // Start of range of contents currently stored in |buf|. | |
| 414 int64 end_range; // End of range of contents currently stored in |buf|. | |
| 415 int64 content_length; // File content-Length. | |
| 416 std::string content_type; // Content-Type of file. | |
| 417 scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded. | |
| 418 GURL upload_location; // Url of where to upload the file to. | |
| 419 // Virtual GData path of the file seen in the UI. Not necessary for | |
| 420 // resuming an upload, but used for adding an entry to OperationRegistry. | |
| 421 FilePath virtual_path; | |
| 422 }; | |
| 423 | |
| 424 // Callback type for DocumentServiceInterface::ResumeUpload. | |
| 425 typedef base::Callback<void( | |
| 426 const ResumeUploadResponse& response, | |
| 427 scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; | |
| 428 | |
| 429 // This class performs the operation for resuming the upload of a file. | |
| 430 class ResumeUploadOperation : public UrlFetchOperationBase { | |
| 431 public: | |
| 432 ResumeUploadOperation(OperationRegistry* registry, | |
| 433 const ResumeUploadCallback& callback, | |
| 434 const ResumeUploadParams& params); | |
| 435 virtual ~ResumeUploadOperation(); | |
| 436 | |
| 437 protected: | |
| 438 // Overridden from UrlFetchOperationBase. | |
| 439 virtual GURL GetURL() const OVERRIDE; | |
| 440 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | |
| 441 virtual void NotifyStartToOperationRegistry() OVERRIDE; | |
| 442 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | |
| 443 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | |
| 444 | |
| 445 // Overridden from UrlFetchOperationBase. | |
| 446 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
| 447 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | |
| 448 virtual bool GetContentData(std::string* upload_content_type, | |
| 449 std::string* upload_content) OVERRIDE; | |
| 450 | |
| 451 // Overridden from content::UrlFetcherDelegate | |
| 452 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, | |
| 453 int64 current, int64 total) OVERRIDE; | |
| 454 | |
| 455 private: | |
| 456 ResumeUploadCallback callback_; | |
| 457 ResumeUploadParams params_; | |
| 458 bool last_chunk_completed_; | |
| 459 | |
| 460 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); | |
| 461 }; | |
| 462 | |
| 463 //========================== GetContactGroupsOperation ========================= | |
| 464 | |
| 465 // This class fetches a JSON feed containing a user's contact groups. | |
| 466 class GetContactGroupsOperation : public GetDataOperation { | |
| 467 public: | |
| 468 GetContactGroupsOperation(OperationRegistry* registry, | |
| 469 const GetDataCallback& callback); | |
| 470 virtual ~GetContactGroupsOperation(); | |
| 471 | |
| 472 void set_feed_url_for_testing(const GURL& url) { | |
| 473 feed_url_for_testing_ = url; | |
| 474 } | |
| 475 | |
| 476 protected: | |
| 477 // Overridden from GetDataOperation. | |
| 478 virtual GURL GetURL() const OVERRIDE; | |
| 479 | |
| 480 private: | |
| 481 // If non-empty, URL of the feed to fetch. | |
| 482 GURL feed_url_for_testing_; | |
| 483 | |
| 484 DISALLOW_COPY_AND_ASSIGN(GetContactGroupsOperation); | |
| 485 }; | |
| 486 | |
| 487 //============================ GetContactsOperation ============================ | |
| 488 | |
| 489 // This class fetches a JSON feed containing a user's contacts. | |
| 490 class GetContactsOperation : public GetDataOperation { | |
| 491 public: | |
| 492 GetContactsOperation(OperationRegistry* registry, | |
| 493 const std::string& group_id, | |
| 494 const base::Time& min_update_time, | |
| 495 const GetDataCallback& callback); | |
| 496 virtual ~GetContactsOperation(); | |
| 497 | |
| 498 void set_feed_url_for_testing(const GURL& url) { | |
| 499 feed_url_for_testing_ = url; | |
| 500 } | |
| 501 | |
| 502 protected: | |
| 503 // Overridden from GetDataOperation. | |
| 504 virtual GURL GetURL() const OVERRIDE; | |
| 505 | |
| 506 private: | |
| 507 // If non-empty, URL of the feed to fetch. | |
| 508 GURL feed_url_for_testing_; | |
| 509 | |
| 510 // If non-empty, contains the ID of the group whose contacts should be | |
| 511 // returned. Group IDs generally look like this: | |
| 512 // http://www.google.com/m8/feeds/groups/user%40gmail.com/base/6 | |
| 513 std::string group_id_; | |
| 514 | |
| 515 // If is_null() is false, contains a minimum last-updated time that will be | |
| 516 // used to filter contacts. | |
| 517 base::Time min_update_time_; | |
| 518 | |
| 519 DISALLOW_COPY_AND_ASSIGN(GetContactsOperation); | |
| 520 }; | |
| 521 | |
| 522 //========================== GetContactPhotoOperation ========================== | |
| 523 | |
| 524 // This class fetches a contact's photo. | |
| 525 class GetContactPhotoOperation : public UrlFetchOperationBase { | |
| 526 public: | |
| 527 GetContactPhotoOperation(OperationRegistry* registry, | |
| 528 const GURL& photo_url, | |
| 529 const GetContentCallback& callback); | |
| 530 virtual ~GetContactPhotoOperation(); | |
| 531 | |
| 532 protected: | |
| 533 // Overridden from UrlFetchOperationBase. | |
| 534 virtual GURL GetURL() const OVERRIDE; | |
| 535 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | |
| 536 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | |
| 537 | |
| 538 private: | |
| 539 // Location of the photo to fetch. | |
| 540 GURL photo_url_; | |
| 541 | |
| 542 // Callback to which the photo data is passed. | |
| 543 GetContentCallback callback_; | |
| 544 | |
| 545 DISALLOW_COPY_AND_ASSIGN(GetContactPhotoOperation); | |
| 546 }; | |
| 547 | |
| 548 } // namespace gdata | |
| 549 | |
| 550 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | |
| OLD | NEW |