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

Side by Side Diff: chrome/browser/chromeos/gdata/drive_api_parser.h

Issue 10836205: Parse labels under File resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/drive_api_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
295 std::string file_id_; 295 std::string file_id_;
296 GURL parent_link_; 296 GURL parent_link_;
297 bool is_root_; 297 bool is_root_;
298 298
299 DISALLOW_COPY_AND_ASSIGN(ParentReference); 299 DISALLOW_COPY_AND_ASSIGN(ParentReference);
300 }; 300 };
301 301
302 // FileLabels represents labels for file or folder.
303 // https://developers.google.com/drive/v2/reference/files
304 class FileLabels {
305 public:
306
307 ~FileLabels();
308
309 // Registers the mapping between JSON field names and the members in this
310 // class.
311 static void RegisterJSONConverter(
312 base::JSONValueConverter<FileLabels>* converter);
313
314 // Creates about resource from parsed JSON.
315 static scoped_ptr<FileLabels> CreateFrom(const base::Value& value);
316
317 // Whether this file is starred by the user.
318 bool is_starred() const { return starred_; }
319 // Whether this file is hidden from the user.
320 bool is_hidden() const { return hidden_; }
321 // Whether this file has been trashed.
322 bool is_trashed() const { return trashed_; }
323 // Whether viewers are prevented from downloading this file.
324 bool is_restricted() const { return restricted_; }
325 // Whether this file has been viewed by this user.
326 bool is_viewed() const { return viewed_; }
327
328 private:
329 friend class FileResource;
330 FileLabels();
331
332 // Parses and initializes data members from content of |value|.
333 // Return false if parsing fails.
334 bool Parse(const base::Value& value);
335
336 bool starred_;
337 bool hidden_;
338 bool trashed_;
339 bool restricted_;
340 bool viewed_;
341
342 DISALLOW_COPY_AND_ASSIGN(FileLabels);
343 };
344
302 // FileResource represents a file or folder metadata in Drive. 345 // FileResource represents a file or folder metadata in Drive.
303 // https://developers.google.com/drive/v2/reference/files 346 // https://developers.google.com/drive/v2/reference/files
304 class FileResource { 347 class FileResource {
305 public: 348 public:
306 ~FileResource(); 349 ~FileResource();
307 350
308 // Registers the mapping between JSON field names and the members in this 351 // Registers the mapping between JSON field names and the members in this
309 // class. 352 // class.
310 static void RegisterJSONConverter( 353 static void RegisterJSONConverter(
311 base::JSONValueConverter<FileResource>* converter); 354 base::JSONValueConverter<FileResource>* converter);
(...skipping 19 matching lines...) Expand all
331 374
332 // Returns the link to JSON of this file itself. 375 // Returns the link to JSON of this file itself.
333 const GURL& self_link() const { return self_link_; } 376 const GURL& self_link() const { return self_link_; }
334 377
335 // Returns the title of this file. 378 // Returns the title of this file.
336 const std::string& title() const { return title_; } 379 const std::string& title() const { return title_; }
337 380
338 // Returns MIME type of this file. 381 // Returns MIME type of this file.
339 const std::string& mime_type() const { return mime_type_; } 382 const std::string& mime_type() const { return mime_type_; }
340 383
384 // Returns labels for this file.
385 const FileLabels& labels() const { return labels_; }
386
341 // Returns created time of this file. 387 // Returns created time of this file.
342 const base::Time& created_date() const { return created_date_; } 388 const base::Time& created_date() const { return created_date_; }
343 389
344 // Returns modification time by the user. 390 // Returns modification time by the user.
345 const base::Time& modified_by_me_date() const { return modified_by_me_date_; } 391 const base::Time& modified_by_me_date() const { return modified_by_me_date_; }
346 392
347 // Returns the short-lived download URL for the file. This field exists 393 // Returns the short-lived download URL for the file. This field exists
348 // only when the file content is stored in Drive. 394 // only when the file content is stored in Drive.
349 const GURL& download_url() const { return download_url_; } 395 const GURL& download_url() const { return download_url_; }
350 396
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 428
383 // Parses and initializes data members from content of |value|. 429 // Parses and initializes data members from content of |value|.
384 // Return false if parsing fails. 430 // Return false if parsing fails.
385 bool Parse(const base::Value& value); 431 bool Parse(const base::Value& value);
386 432
387 std::string file_id_; 433 std::string file_id_;
388 std::string etag_; 434 std::string etag_;
389 GURL self_link_; 435 GURL self_link_;
390 std::string title_; 436 std::string title_;
391 std::string mime_type_; 437 std::string mime_type_;
438 FileLabels labels_;
392 base::Time created_date_; 439 base::Time created_date_;
393 base::Time modified_by_me_date_; 440 base::Time modified_by_me_date_;
394 GURL download_url_; 441 GURL download_url_;
395 std::string file_extension_; 442 std::string file_extension_;
396 std::string md5_checksum_; 443 std::string md5_checksum_;
397 int64 file_size_; 444 int64 file_size_;
398 GURL alternate_link_; 445 GURL alternate_link_;
399 GURL embed_link_; 446 GURL embed_link_;
400 ScopedVector<ParentReference> parents_; 447 ScopedVector<ParentReference> parents_;
401 GURL thumbnail_link_; 448 GURL thumbnail_link_;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 GURL next_link_; 585 GURL next_link_;
539 int64 largest_change_id_; 586 int64 largest_change_id_;
540 ScopedVector<ChangeResource> items_; 587 ScopedVector<ChangeResource> items_;
541 588
542 DISALLOW_COPY_AND_ASSIGN(ChangeList); 589 DISALLOW_COPY_AND_ASSIGN(ChangeList);
543 }; 590 };
544 591
545 } // namespace gdata 592 } // namespace gdata
546 593
547 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ 594 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/drive_api_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698