Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: google_apis/drive/drive_api_parser.h

Issue 216433002: drive: Make FileResource copyable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_PARSER_H_ 5 #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_
6 #define GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ 6 #define GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // Returns true if the reference is root directory. 358 // Returns true if the reference is root directory.
359 bool is_root() const { return is_root_; } 359 bool is_root() const { return is_root_; }
360 360
361 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 361 void set_file_id(const std::string& file_id) { file_id_ = file_id; }
362 void set_parent_link(const GURL& parent_link) { 362 void set_parent_link(const GURL& parent_link) {
363 parent_link_ = parent_link; 363 parent_link_ = parent_link;
364 } 364 }
365 void set_is_root(bool is_root) { is_root_ = is_root; } 365 void set_is_root(bool is_root) { is_root_ = is_root; }
366 366
367 private: 367 private:
368 friend class base::internal::RepeatedMessageConverter<ParentReference>;
369
370 // Parses and initializes data members from content of |value|. 368 // Parses and initializes data members from content of |value|.
371 // Return false if parsing fails. 369 // Return false if parsing fails.
372 bool Parse(const base::Value& value); 370 bool Parse(const base::Value& value);
373 371
374 std::string file_id_; 372 std::string file_id_;
375 GURL parent_link_; 373 GURL parent_link_;
376 bool is_root_; 374 bool is_root_;
377
378 DISALLOW_COPY_AND_ASSIGN(ParentReference);
379 }; 375 };
380 376
381 // FileLabels represents labels for file or folder. 377 // FileLabels represents labels for file or folder.
382 // https://developers.google.com/drive/v2/reference/files 378 // https://developers.google.com/drive/v2/reference/files
383 class FileLabels { 379 class FileLabels {
384 public: 380 public:
385 FileLabels(); 381 FileLabels();
386 ~FileLabels(); 382 ~FileLabels();
387 383
388 // Registers the mapping between JSON field names and the members in this 384 // Registers the mapping between JSON field names and the members in this
(...skipping 26 matching lines...) Expand all
415 411
416 // Parses and initializes data members from content of |value|. 412 // Parses and initializes data members from content of |value|.
417 // Return false if parsing fails. 413 // Return false if parsing fails.
418 bool Parse(const base::Value& value); 414 bool Parse(const base::Value& value);
419 415
420 bool starred_; 416 bool starred_;
421 bool hidden_; 417 bool hidden_;
422 bool trashed_; 418 bool trashed_;
423 bool restricted_; 419 bool restricted_;
424 bool viewed_; 420 bool viewed_;
425
426 DISALLOW_COPY_AND_ASSIGN(FileLabels);
427 }; 421 };
428 422
429 // ImageMediaMetadata represents image metadata for a file. 423 // ImageMediaMetadata represents image metadata for a file.
430 // https://developers.google.com/drive/v2/reference/files 424 // https://developers.google.com/drive/v2/reference/files
431 class ImageMediaMetadata { 425 class ImageMediaMetadata {
432 public: 426 public:
433 ImageMediaMetadata(); 427 ImageMediaMetadata();
434 ~ImageMediaMetadata(); 428 ~ImageMediaMetadata();
435 429
436 // Registers the mapping between JSON field names and the members in this 430 // Registers the mapping between JSON field names and the members in this
(...skipping 18 matching lines...) Expand all
455 private: 449 private:
456 friend class FileResource; 450 friend class FileResource;
457 451
458 // Parses and initializes data members from content of |value|. 452 // Parses and initializes data members from content of |value|.
459 // Return false if parsing fails. 453 // Return false if parsing fails.
460 bool Parse(const base::Value& value); 454 bool Parse(const base::Value& value);
461 455
462 int width_; 456 int width_;
463 int height_; 457 int height_;
464 int rotation_; 458 int rotation_;
465
466 DISALLOW_COPY_AND_ASSIGN(ImageMediaMetadata);
467 }; 459 };
468 460
469 461
470 // FileResource represents a file or folder metadata in Drive. 462 // FileResource represents a file or folder metadata in Drive.
471 // https://developers.google.com/drive/v2/reference/files 463 // https://developers.google.com/drive/v2/reference/files
472 class FileResource { 464 class FileResource {
473 public: 465 public:
474 // Link to open a file resource on a web app with |app_id|. 466 // Link to open a file resource on a web app with |app_id|.
475 struct OpenWithLink { 467 struct OpenWithLink {
476 std::string app_id; 468 std::string app_id;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 const std::string& md5_checksum() const { return md5_checksum_; } 534 const std::string& md5_checksum() const { return md5_checksum_; }
543 535
544 // Returns the size of this file in bytes. 536 // Returns the size of this file in bytes.
545 int64 file_size() const { return file_size_; } 537 int64 file_size() const { return file_size_; }
546 538
547 // Return the link to open the file in Google editor or viewer. 539 // Return the link to open the file in Google editor or viewer.
548 // E.g. Google Document, Google Spreadsheet. 540 // E.g. Google Document, Google Spreadsheet.
549 const GURL& alternate_link() const { return alternate_link_; } 541 const GURL& alternate_link() const { return alternate_link_; }
550 542
551 // Returns parent references (directories) of this file. 543 // Returns parent references (directories) of this file.
552 const ScopedVector<ParentReference>& parents() const { return parents_; } 544 const std::vector<ParentReference>& parents() const { return parents_; }
553 ScopedVector<ParentReference>* mutable_parents() { return &parents_; }
554 545
555 // Returns the list of links to open the resource with a web app. 546 // Returns the list of links to open the resource with a web app.
556 const std::vector<OpenWithLink>& open_with_links() const { 547 const std::vector<OpenWithLink>& open_with_links() const {
557 return open_with_links_; 548 return open_with_links_;
558 } 549 }
559 550
560 void set_file_id(const std::string& file_id) { 551 void set_file_id(const std::string& file_id) {
561 file_id_ = file_id; 552 file_id_ = file_id;
562 } 553 }
563 void set_etag(const std::string& etag) { 554 void set_etag(const std::string& etag) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 } 589 }
599 void set_md5_checksum(const std::string& md5_checksum) { 590 void set_md5_checksum(const std::string& md5_checksum) {
600 md5_checksum_ = md5_checksum; 591 md5_checksum_ = md5_checksum;
601 } 592 }
602 void set_file_size(int64 file_size) { 593 void set_file_size(int64 file_size) {
603 file_size_ = file_size; 594 file_size_ = file_size;
604 } 595 }
605 void set_alternate_link(const GURL& alternate_link) { 596 void set_alternate_link(const GURL& alternate_link) {
606 alternate_link_ = alternate_link; 597 alternate_link_ = alternate_link;
607 } 598 }
608 void set_parents(ScopedVector<ParentReference> parents) { 599 std::vector<ParentReference>* mutable_parents() { return &parents_; }
609 parents_ = parents.Pass(); 600 std::vector<OpenWithLink>* mutable_open_with_links() {
601 return &open_with_links_;
610 } 602 }
611 603
612 private: 604 private:
613 friend class base::internal::RepeatedMessageConverter<FileResource>; 605 friend class base::internal::RepeatedMessageConverter<FileResource>;
614 friend class ChangeResource; 606 friend class ChangeResource;
615 friend class FileList; 607 friend class FileList;
616 608
617 // Parses and initializes data members from content of |value|. 609 // Parses and initializes data members from content of |value|.
618 // Return false if parsing fails. 610 // Return false if parsing fails.
619 bool Parse(const base::Value& value); 611 bool Parse(const base::Value& value);
620 612
621 std::string file_id_; 613 std::string file_id_;
622 std::string etag_; 614 std::string etag_;
623 std::string title_; 615 std::string title_;
624 std::string mime_type_; 616 std::string mime_type_;
625 FileLabels labels_; 617 FileLabels labels_;
626 ImageMediaMetadata image_media_metadata_; 618 ImageMediaMetadata image_media_metadata_;
627 base::Time created_date_; 619 base::Time created_date_;
628 base::Time modified_date_; 620 base::Time modified_date_;
629 base::Time modified_by_me_date_; 621 base::Time modified_by_me_date_;
630 base::Time last_viewed_by_me_date_; 622 base::Time last_viewed_by_me_date_;
631 base::Time shared_with_me_date_; 623 base::Time shared_with_me_date_;
632 bool shared_; 624 bool shared_;
633 std::string file_extension_; 625 std::string file_extension_;
634 std::string md5_checksum_; 626 std::string md5_checksum_;
635 int64 file_size_; 627 int64 file_size_;
636 GURL alternate_link_; 628 GURL alternate_link_;
637 ScopedVector<ParentReference> parents_; 629 std::vector<ParentReference> parents_;
638 std::vector<OpenWithLink> open_with_links_; 630 std::vector<OpenWithLink> open_with_links_;
639
640 DISALLOW_COPY_AND_ASSIGN(FileResource);
641 }; 631 };
642 632
643 // FileList represents a collection of files and folders. 633 // FileList represents a collection of files and folders.
644 // https://developers.google.com/drive/v2/reference/files/list 634 // https://developers.google.com/drive/v2/reference/files/list
645 class FileList { 635 class FileList {
646 public: 636 public:
647 FileList(); 637 FileList();
648 ~FileList(); 638 ~FileList();
649 639
650 // Registers the mapping between JSON field names and the members in this 640 // Registers the mapping between JSON field names and the members in this
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 GURL next_link_; 820 GURL next_link_;
831 int64 largest_change_id_; 821 int64 largest_change_id_;
832 ScopedVector<ChangeResource> items_; 822 ScopedVector<ChangeResource> items_;
833 823
834 DISALLOW_COPY_AND_ASSIGN(ChangeList); 824 DISALLOW_COPY_AND_ASSIGN(ChangeList);
835 }; 825 };
836 826
837 } // namespace google_apis 827 } // namespace google_apis
838 828
839 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ 829 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698