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

Side by Side Diff: chrome/browser/google_apis/drive_api_parser.h

Issue 23979003: Replace swap with Pass() on setters in drive_api_parser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_PARSER_H_ 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_PARSER_H_
6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_PARSER_H_ 6 #define CHROME_BROWSER_GOOGLE_APIS_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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 258 }
259 void set_supports_import(bool supports_import) { 259 void set_supports_import(bool supports_import) {
260 supports_import_ = supports_import; 260 supports_import_ = supports_import;
261 } 261 }
262 void set_installed(bool installed) { installed_ = installed; } 262 void set_installed(bool installed) { installed_ = installed; }
263 void set_authorized(bool authorized) { authorized_ = authorized; } 263 void set_authorized(bool authorized) { authorized_ = authorized; }
264 void set_product_url(const GURL& product_url) { 264 void set_product_url(const GURL& product_url) {
265 product_url_ = product_url; 265 product_url_ = product_url;
266 } 266 }
267 void set_primary_mimetypes( 267 void set_primary_mimetypes(
268 ScopedVector<std::string>* primary_mimetypes) { 268 ScopedVector<std::string> primary_mimetypes) {
269 primary_mimetypes_.swap(*primary_mimetypes); 269 primary_mimetypes_ = primary_mimetypes.Pass();
270 } 270 }
271 void set_secondary_mimetypes( 271 void set_secondary_mimetypes(
272 ScopedVector<std::string>* secondary_mimetypes) { 272 ScopedVector<std::string> secondary_mimetypes) {
273 secondary_mimetypes_.swap(*secondary_mimetypes); 273 secondary_mimetypes_ = secondary_mimetypes.Pass();
274 } 274 }
275 void set_primary_file_extensions( 275 void set_primary_file_extensions(
276 ScopedVector<std::string>* primary_file_extensions) { 276 ScopedVector<std::string> primary_file_extensions) {
277 primary_file_extensions_.swap(*primary_file_extensions); 277 primary_file_extensions_ = primary_file_extensions.Pass();
278 } 278 }
279 void set_secondary_file_extensions( 279 void set_secondary_file_extensions(
280 ScopedVector<std::string>* secondary_file_extensions) { 280 ScopedVector<std::string> secondary_file_extensions) {
281 secondary_file_extensions_.swap(*secondary_file_extensions); 281 secondary_file_extensions_ = secondary_file_extensions.Pass();
282 } 282 }
283 void set_icons(ScopedVector<DriveAppIcon>* icons) { 283 void set_icons(ScopedVector<DriveAppIcon> icons) {
284 icons_.swap(*icons); 284 icons_ = icons.Pass();
285 } 285 }
286 286
287 private: 287 private:
288 friend class base::internal::RepeatedMessageConverter<AppResource>; 288 friend class base::internal::RepeatedMessageConverter<AppResource>;
289 friend class AppList; 289 friend class AppList;
290 290
291 // Parses and initializes data members from content of |value|. 291 // Parses and initializes data members from content of |value|.
292 // Return false if parsing fails. 292 // Return false if parsing fails.
293 bool Parse(const base::Value& value); 293 bool Parse(const base::Value& value);
294 294
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 // ETag for this resource. 333 // ETag for this resource.
334 const std::string& etag() const { return etag_; } 334 const std::string& etag() const { return etag_; }
335 335
336 // Returns a vector of applications. 336 // Returns a vector of applications.
337 const ScopedVector<AppResource>& items() const { return items_; } 337 const ScopedVector<AppResource>& items() const { return items_; }
338 338
339 void set_etag(const std::string& etag) { 339 void set_etag(const std::string& etag) {
340 etag_ = etag; 340 etag_ = etag;
341 } 341 }
342 void set_items(ScopedVector<AppResource>* items) { 342 void set_items(ScopedVector<AppResource> items) {
343 items_.swap(*items); 343 items_ = items.Pass();
344 } 344 }
345 345
346 private: 346 private:
347 friend class DriveAPIParserTest; 347 friend class DriveAPIParserTest;
348 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, AppListParser); 348 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, AppListParser);
349 349
350 // Parses and initializes data members from content of |value|. 350 // Parses and initializes data members from content of |value|.
351 // Return false if parsing fails. 351 // Return false if parsing fails.
352 bool Parse(const base::Value& value); 352 bool Parse(const base::Value& value);
353 353
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 593 }
594 void set_file_size(int64 file_size) { 594 void set_file_size(int64 file_size) {
595 file_size_ = file_size; 595 file_size_ = file_size;
596 } 596 }
597 void set_alternate_link(const GURL& alternate_link) { 597 void set_alternate_link(const GURL& alternate_link) {
598 alternate_link_ = alternate_link; 598 alternate_link_ = alternate_link;
599 } 599 }
600 void set_embed_link(const GURL& embed_link) { 600 void set_embed_link(const GURL& embed_link) {
601 embed_link_ = embed_link; 601 embed_link_ = embed_link;
602 } 602 }
603 void set_parents(ScopedVector<ParentReference>* parents) { 603 void set_parents(ScopedVector<ParentReference> parents) {
604 parents_.swap(*parents); 604 parents_ = parents.Pass();
605 } 605 }
606 void set_thumbnail_link(const GURL& thumbnail_link) { 606 void set_thumbnail_link(const GURL& thumbnail_link) {
607 thumbnail_link_ = thumbnail_link; 607 thumbnail_link_ = thumbnail_link;
608 } 608 }
609 void set_web_content_link(const GURL& web_content_link) { 609 void set_web_content_link(const GURL& web_content_link) {
610 web_content_link_ = web_content_link; 610 web_content_link_ = web_content_link;
611 } 611 }
612 612
613 private: 613 private:
614 friend class base::internal::RepeatedMessageConverter<FileResource>; 614 friend class base::internal::RepeatedMessageConverter<FileResource>;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 678
679 void set_etag(const std::string& etag) { 679 void set_etag(const std::string& etag) {
680 etag_ = etag; 680 etag_ = etag;
681 } 681 }
682 void set_next_page_token(const std::string& next_page_token) { 682 void set_next_page_token(const std::string& next_page_token) {
683 next_page_token_ = next_page_token; 683 next_page_token_ = next_page_token;
684 } 684 }
685 void set_next_link(const GURL& next_link) { 685 void set_next_link(const GURL& next_link) {
686 next_link_ = next_link; 686 next_link_ = next_link;
687 } 687 }
688 void set_items(ScopedVector<FileResource>* items) { 688 void set_items(ScopedVector<FileResource> items) {
689 items_.swap(*items); 689 items_ = items.Pass();
690 } 690 }
691 691
692 private: 692 private:
693 friend class DriveAPIParserTest; 693 friend class DriveAPIParserTest;
694 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, FileListParser); 694 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, FileListParser);
695 695
696 // Parses and initializes data members from content of |value|. 696 // Parses and initializes data members from content of |value|.
697 // Return false if parsing fails. 697 // Return false if parsing fails.
698 bool Parse(const base::Value& value); 698 bool Parse(const base::Value& value);
699 699
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 } 802 }
803 void set_next_page_token(const std::string& next_page_token) { 803 void set_next_page_token(const std::string& next_page_token) {
804 next_page_token_ = next_page_token; 804 next_page_token_ = next_page_token;
805 } 805 }
806 void set_next_link(const GURL& next_link) { 806 void set_next_link(const GURL& next_link) {
807 next_link_ = next_link; 807 next_link_ = next_link;
808 } 808 }
809 void set_largest_change_id(int64 largest_change_id) { 809 void set_largest_change_id(int64 largest_change_id) {
810 largest_change_id_ = largest_change_id; 810 largest_change_id_ = largest_change_id;
811 } 811 }
812 void set_items(ScopedVector<ChangeResource>* items) { 812 void set_items(ScopedVector<ChangeResource> items) {
813 items_.swap(*items); 813 items_ = items.Pass();
814 } 814 }
815 815
816 private: 816 private:
817 friend class DriveAPIParserTest; 817 friend class DriveAPIParserTest;
818 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, ChangeListParser); 818 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, ChangeListParser);
819 819
820 // Parses and initializes data members from content of |value|. 820 // Parses and initializes data members from content of |value|.
821 // Return false if parsing fails. 821 // Return false if parsing fails.
822 bool Parse(const base::Value& value); 822 bool Parse(const base::Value& value);
823 823
824 std::string etag_; 824 std::string etag_;
825 std::string next_page_token_; 825 std::string next_page_token_;
826 GURL next_link_; 826 GURL next_link_;
827 int64 largest_change_id_; 827 int64 largest_change_id_;
828 ScopedVector<ChangeResource> items_; 828 ScopedVector<ChangeResource> items_;
829 829
830 DISALLOW_COPY_AND_ASSIGN(ChangeList); 830 DISALLOW_COPY_AND_ASSIGN(ChangeList);
831 }; 831 };
832 832
833 } // namespace google_apis 833 } // namespace google_apis
834 834
835 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_PARSER_H_ 835 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_PARSER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/file_tasks_unittest.cc ('k') | chrome/browser/google_apis/drive_api_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698