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_DRIVE_API_PARSER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 // Return false if parsing fails. | 289 // Return false if parsing fails. |
290 bool Parse(const base::Value& value); | 290 bool Parse(const base::Value& value); |
291 | 291 |
292 std::string file_id_; | 292 std::string file_id_; |
293 GURL parent_link_; | 293 GURL parent_link_; |
294 bool is_root_; | 294 bool is_root_; |
295 | 295 |
296 DISALLOW_COPY_AND_ASSIGN(ParentReference); | 296 DISALLOW_COPY_AND_ASSIGN(ParentReference); |
297 }; | 297 }; |
298 | 298 |
| 299 // FileLabels represents labels for file or folder. |
| 300 // https://developers.google.com/drive/v2/reference/files |
| 301 class FileLabels { |
| 302 public: |
| 303 |
| 304 ~FileLabels(); |
| 305 |
| 306 // Registers the mapping between JSON field names and the members in this |
| 307 // class. |
| 308 static void RegisterJSONConverter( |
| 309 base::JSONValueConverter<FileLabels>* converter); |
| 310 |
| 311 // Creates about resource from parsed JSON. |
| 312 static scoped_ptr<FileLabels> CreateFrom(const base::Value& value); |
| 313 |
| 314 // Whether this file is starred by the user. |
| 315 bool is_starred() const { return starred_; } |
| 316 // Whether this file is hidden from the user. |
| 317 bool is_hidden() const { return hidden_; } |
| 318 // Whether this file has been trashed. |
| 319 bool is_trashed() const { return trashed_; } |
| 320 // Whether viewers are prevented from downloading this file. |
| 321 bool is_restricted() const { return restricted_; } |
| 322 // Whether this file has been viewed by this user. |
| 323 bool is_viewed() const { return viewed_; } |
| 324 |
| 325 private: |
| 326 friend class FileResource; |
| 327 FileLabels(); |
| 328 |
| 329 // Parses and initializes data members from content of |value|. |
| 330 // Return false if parsing fails. |
| 331 bool Parse(const base::Value& value); |
| 332 |
| 333 bool starred_; |
| 334 bool hidden_; |
| 335 bool trashed_; |
| 336 bool restricted_; |
| 337 bool viewed_; |
| 338 |
| 339 DISALLOW_COPY_AND_ASSIGN(FileLabels); |
| 340 }; |
| 341 |
299 // FileResource represents a file or folder metadata in Drive. | 342 // FileResource represents a file or folder metadata in Drive. |
300 // https://developers.google.com/drive/v2/reference/files | 343 // https://developers.google.com/drive/v2/reference/files |
301 class FileResource { | 344 class FileResource { |
302 public: | 345 public: |
303 ~FileResource(); | 346 ~FileResource(); |
304 | 347 |
305 // Registers the mapping between JSON field names and the members in this | 348 // Registers the mapping between JSON field names and the members in this |
306 // class. | 349 // class. |
307 static void RegisterJSONConverter( | 350 static void RegisterJSONConverter( |
308 base::JSONValueConverter<FileResource>* converter); | 351 base::JSONValueConverter<FileResource>* converter); |
(...skipping 14 matching lines...) Expand all Loading... |
323 | 366 |
324 // Returns the link to JSON of this file itself. | 367 // Returns the link to JSON of this file itself. |
325 const GURL& self_link() const { return self_link_; } | 368 const GURL& self_link() const { return self_link_; } |
326 | 369 |
327 // Returns the title of this file. | 370 // Returns the title of this file. |
328 const std::string& title() const { return title_; } | 371 const std::string& title() const { return title_; } |
329 | 372 |
330 // Returns MIME type of this file. | 373 // Returns MIME type of this file. |
331 const std::string& mime_type() const { return mime_type_; } | 374 const std::string& mime_type() const { return mime_type_; } |
332 | 375 |
| 376 // Returns labels for this file. |
| 377 const FileLabels& labels() const { return labels_; } |
| 378 |
333 // Returns created time of this file. | 379 // Returns created time of this file. |
334 const base::Time& created_date() const { return created_date_; } | 380 const base::Time& created_date() const { return created_date_; } |
335 | 381 |
336 // Returns modification time by the user. | 382 // Returns modification time by the user. |
337 const base::Time& modified_by_me_date() const { return modified_by_me_date_; } | 383 const base::Time& modified_by_me_date() const { return modified_by_me_date_; } |
338 | 384 |
339 // Returns the short-lived download URL for the file. This field exists | 385 // Returns the short-lived download URL for the file. This field exists |
340 // only when the file content is stored in Drive. | 386 // only when the file content is stored in Drive. |
341 const GURL& download_url() const { return download_url_; } | 387 const GURL& download_url() const { return download_url_; } |
342 | 388 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 420 |
375 // Parses and initializes data members from content of |value|. | 421 // Parses and initializes data members from content of |value|. |
376 // Return false if parsing fails. | 422 // Return false if parsing fails. |
377 bool Parse(const base::Value& value); | 423 bool Parse(const base::Value& value); |
378 | 424 |
379 std::string file_id_; | 425 std::string file_id_; |
380 std::string etag_; | 426 std::string etag_; |
381 GURL self_link_; | 427 GURL self_link_; |
382 std::string title_; | 428 std::string title_; |
383 std::string mime_type_; | 429 std::string mime_type_; |
| 430 FileLabels labels_; |
384 base::Time created_date_; | 431 base::Time created_date_; |
385 base::Time modified_by_me_date_; | 432 base::Time modified_by_me_date_; |
386 GURL download_url_; | 433 GURL download_url_; |
387 std::string file_extension_; | 434 std::string file_extension_; |
388 std::string md5_checksum_; | 435 std::string md5_checksum_; |
389 int64 file_size_; | 436 int64 file_size_; |
390 GURL alternate_link_; | 437 GURL alternate_link_; |
391 GURL embed_link_; | 438 GURL embed_link_; |
392 ScopedVector<ParentReference> parents_; | 439 ScopedVector<ParentReference> parents_; |
393 GURL thumbnail_link_; | 440 GURL thumbnail_link_; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 GURL next_link_; | 577 GURL next_link_; |
531 int64 largest_change_id_; | 578 int64 largest_change_id_; |
532 ScopedVector<ChangeResource> items_; | 579 ScopedVector<ChangeResource> items_; |
533 | 580 |
534 DISALLOW_COPY_AND_ASSIGN(ChangeList); | 581 DISALLOW_COPY_AND_ASSIGN(ChangeList); |
535 }; | 582 }; |
536 | 583 |
537 } // namespace gdata | 584 } // namespace gdata |
538 | 585 |
539 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ | 586 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ |
OLD | NEW |