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 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 <stdint.h> | 8 #include <stdint.h> |
9 | |
10 #include <string> | 9 #include <string> |
| 10 #include <utility> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 | 20 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 void set_object_type(const std::string& object_type) { | 227 void set_object_type(const std::string& object_type) { |
228 object_type_ = object_type; | 228 object_type_ = object_type; |
229 } | 229 } |
230 void set_product_id(const std::string& id) { product_id_ = id; } | 230 void set_product_id(const std::string& id) { product_id_ = id; } |
231 void set_supports_create(bool supports_create) { | 231 void set_supports_create(bool supports_create) { |
232 supports_create_ = supports_create; | 232 supports_create_ = supports_create; |
233 } | 233 } |
234 void set_removable(bool removable) { removable_ = removable; } | 234 void set_removable(bool removable) { removable_ = removable; } |
235 void set_primary_mimetypes( | 235 void set_primary_mimetypes( |
236 ScopedVector<std::string> primary_mimetypes) { | 236 ScopedVector<std::string> primary_mimetypes) { |
237 primary_mimetypes_ = primary_mimetypes.Pass(); | 237 primary_mimetypes_ = std::move(primary_mimetypes); |
238 } | 238 } |
239 void set_secondary_mimetypes( | 239 void set_secondary_mimetypes( |
240 ScopedVector<std::string> secondary_mimetypes) { | 240 ScopedVector<std::string> secondary_mimetypes) { |
241 secondary_mimetypes_ = secondary_mimetypes.Pass(); | 241 secondary_mimetypes_ = std::move(secondary_mimetypes); |
242 } | 242 } |
243 void set_primary_file_extensions( | 243 void set_primary_file_extensions( |
244 ScopedVector<std::string> primary_file_extensions) { | 244 ScopedVector<std::string> primary_file_extensions) { |
245 primary_file_extensions_ = primary_file_extensions.Pass(); | 245 primary_file_extensions_ = std::move(primary_file_extensions); |
246 } | 246 } |
247 void set_secondary_file_extensions( | 247 void set_secondary_file_extensions( |
248 ScopedVector<std::string> secondary_file_extensions) { | 248 ScopedVector<std::string> secondary_file_extensions) { |
249 secondary_file_extensions_ = secondary_file_extensions.Pass(); | 249 secondary_file_extensions_ = std::move(secondary_file_extensions); |
250 } | 250 } |
251 void set_icons(ScopedVector<DriveAppIcon> icons) { | 251 void set_icons(ScopedVector<DriveAppIcon> icons) { |
252 icons_ = icons.Pass(); | 252 icons_ = std::move(icons); |
253 } | 253 } |
254 void set_create_url(const GURL& url) { | 254 void set_create_url(const GURL& url) { |
255 create_url_ = url; | 255 create_url_ = url; |
256 } | 256 } |
257 | 257 |
258 private: | 258 private: |
259 friend class base::internal::RepeatedMessageConverter<AppResource>; | 259 friend class base::internal::RepeatedMessageConverter<AppResource>; |
260 friend class AppList; | 260 friend class AppList; |
261 | 261 |
262 // Parses and initializes data members from content of |value|. | 262 // Parses and initializes data members from content of |value|. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 // ETag for this resource. | 297 // ETag for this resource. |
298 const std::string& etag() const { return etag_; } | 298 const std::string& etag() const { return etag_; } |
299 | 299 |
300 // Returns a vector of applications. | 300 // Returns a vector of applications. |
301 const ScopedVector<AppResource>& items() const { return items_; } | 301 const ScopedVector<AppResource>& items() const { return items_; } |
302 | 302 |
303 void set_etag(const std::string& etag) { | 303 void set_etag(const std::string& etag) { |
304 etag_ = etag; | 304 etag_ = etag; |
305 } | 305 } |
306 void set_items(ScopedVector<AppResource> items) { | 306 void set_items(ScopedVector<AppResource> items) { items_ = std::move(items); } |
307 items_ = items.Pass(); | |
308 } | |
309 | 307 |
310 private: | 308 private: |
311 friend class DriveAPIParserTest; | 309 friend class DriveAPIParserTest; |
312 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, AppListParser); | 310 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, AppListParser); |
313 | 311 |
314 // Parses and initializes data members from content of |value|. | 312 // Parses and initializes data members from content of |value|. |
315 // Return false if parsing fails. | 313 // Return false if parsing fails. |
316 bool Parse(const base::Value& value); | 314 bool Parse(const base::Value& value); |
317 | 315 |
318 std::string etag_; | 316 std::string etag_; |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 // Returns the time of this modification. | 666 // Returns the time of this modification. |
669 const base::Time& modification_date() const { return modification_date_; } | 667 const base::Time& modification_date() const { return modification_date_; } |
670 | 668 |
671 void set_change_id(int64_t change_id) { change_id_ = change_id; } | 669 void set_change_id(int64_t change_id) { change_id_ = change_id; } |
672 void set_file_id(const std::string& file_id) { | 670 void set_file_id(const std::string& file_id) { |
673 file_id_ = file_id; | 671 file_id_ = file_id; |
674 } | 672 } |
675 void set_deleted(bool deleted) { | 673 void set_deleted(bool deleted) { |
676 deleted_ = deleted; | 674 deleted_ = deleted; |
677 } | 675 } |
678 void set_file(scoped_ptr<FileResource> file) { | 676 void set_file(scoped_ptr<FileResource> file) { file_ = std::move(file); } |
679 file_ = file.Pass(); | |
680 } | |
681 void set_modification_date(const base::Time& modification_date) { | 677 void set_modification_date(const base::Time& modification_date) { |
682 modification_date_ = modification_date; | 678 modification_date_ = modification_date; |
683 } | 679 } |
684 | 680 |
685 private: | 681 private: |
686 friend class base::internal::RepeatedMessageConverter<ChangeResource>; | 682 friend class base::internal::RepeatedMessageConverter<ChangeResource>; |
687 friend class ChangeList; | 683 friend class ChangeList; |
688 | 684 |
689 // Parses and initializes data members from content of |value|. | 685 // Parses and initializes data members from content of |value|. |
690 // Return false if parsing fails. | 686 // Return false if parsing fails. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 GURL next_link_; | 742 GURL next_link_; |
747 int64_t largest_change_id_; | 743 int64_t largest_change_id_; |
748 ScopedVector<ChangeResource> items_; | 744 ScopedVector<ChangeResource> items_; |
749 | 745 |
750 DISALLOW_COPY_AND_ASSIGN(ChangeList); | 746 DISALLOW_COPY_AND_ASSIGN(ChangeList); |
751 }; | 747 }; |
752 | 748 |
753 } // namespace google_apis | 749 } // namespace google_apis |
754 | 750 |
755 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ | 751 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ |
OLD | NEW |