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_GDATA_PARSER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 }; | 274 }; |
275 | 275 |
276 // Document feed entry. | 276 // Document feed entry. |
277 class DocumentEntry : public FeedEntry { | 277 class DocumentEntry : public FeedEntry { |
278 public: | 278 public: |
279 enum EntryKind { | 279 enum EntryKind { |
280 UNKNOWN = 0x000000, | 280 UNKNOWN = 0x000000, |
281 // Special entries. | 281 // Special entries. |
282 ITEM = 0x001001, | 282 ITEM = 0x001001, |
283 SITE = 0x001002, | 283 SITE = 0x001002, |
284 // Hosted documents. | 284 // Hosted Google document. |
285 DOCUMENT = 0x002001, | 285 DOCUMENT = 0x002101, |
286 SPREADSHEET = 0x002002, | 286 SPREADSHEET = 0x002102, |
287 PRESENTATION = 0x002003, | 287 PRESENTATION = 0x002103, |
288 DRAWING = 0x002004, | 288 DRAWING = 0x002104, |
289 TABLE = 0x002005, | 289 TABLE = 0x002105, |
290 // Hosted external application document. | |
291 EXTERNAL_APP = 0x002201, | |
290 // Folders, collections. | 292 // Folders, collections. |
291 FOLDER = 0x004001, | 293 FOLDER = 0x004001, |
292 // Regular files. | 294 // Regular files. |
293 FILE = 0x008001, | 295 FILE = 0x008001, |
294 PDF = 0x008002, | 296 PDF = 0x008002, |
295 }; | 297 }; |
296 virtual ~DocumentEntry(); | 298 virtual ~DocumentEntry(); |
297 | 299 |
298 // Creates document entry from parsed JSON Value. You should call | 300 // Creates document entry from parsed JSON Value. You should call |
299 // this instead of instantiating JSONValueConverter by yourself | 301 // this instead of instantiating JSONValueConverter by yourself |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 | 365 |
364 // Text version of document entry kind. Returns an empty string for | 366 // Text version of document entry kind. Returns an empty string for |
365 // unknown entry kind. | 367 // unknown entry kind. |
366 std::string GetEntryKindText() const; | 368 std::string GetEntryKindText() const; |
367 | 369 |
368 // Returns preferred file extension for hosted documents. If entry is not | 370 // Returns preferred file extension for hosted documents. If entry is not |
369 // a hosted document, this call returns an empty string. | 371 // a hosted document, this call returns an empty string. |
370 std::string GetHostedDocumentExtension() const; | 372 std::string GetHostedDocumentExtension() const; |
371 | 373 |
372 // True if document entry is remotely hosted. | 374 // True if document entry is remotely hosted. |
373 bool is_hosted_document() const { return (kind_ & 0x002000) != 0; } | 375 bool is_hosted_document() const { return (kind_ & 0x002000) == 0x002000; } |
376 // True if document entry hosted by Google Documents. | |
377 bool is_google_document() const { return (kind_ & 0x002100) == 0x002100; } | |
378 // True if document entry is hosted by an external application. | |
379 bool is_external_app() const { return (kind_ & 0x002200) == 0x002200; } | |
satorux1
2012/05/16 20:07:09
maybe is_external_app_document() to be more descri
zel
2012/05/16 20:56:14
Done.
| |
374 // True if document entry is a folder (collection). | 380 // True if document entry is a folder (collection). |
375 bool is_folder() const { return (kind_ & 0x004000) != 0; } | 381 bool is_folder() const { return (kind_ & 0x004000) != 0; } |
376 // True if document entry is regular file. | 382 // True if document entry is regular file. |
377 bool is_file() const { return (kind_ & 0x008000) != 0; } | 383 bool is_file() const { return (kind_ & 0x008000) != 0; } |
378 // True if document entry can't be mapped to the file system. | 384 // True if document entry can't be mapped to the file system. |
379 bool is_special() const { | 385 bool is_special() const { |
380 return !is_file() && !is_folder() && !is_hosted_document(); | 386 return !is_file() && !is_folder() && !is_hosted_document(); |
381 } | 387 } |
382 | 388 |
383 private: | 389 private: |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 int largest_changestamp_; | 602 int largest_changestamp_; |
597 ScopedVector<InstalledApp> installed_apps_; | 603 ScopedVector<InstalledApp> installed_apps_; |
598 | 604 |
599 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); | 605 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); |
600 }; | 606 }; |
601 | 607 |
602 | 608 |
603 } // namespace gdata | 609 } // namespace gdata |
604 | 610 |
605 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ | 611 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ |
OLD | NEW |