| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "base/gtest_prod_util.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/scoped_vector.h" | |
| 15 #include "base/string_piece.h" | |
| 16 #include "base/time.h" | |
| 17 #include "googleurl/src/gurl.h" | |
| 18 // TODO(kochi): Eliminate this dependency once dependency to EntryKind is gone. | |
| 19 // http://crbug.com/142293 | |
| 20 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" | |
| 21 | |
| 22 namespace base { | |
| 23 class Value; | |
| 24 template <class StructType> | |
| 25 class JSONValueConverter; | |
| 26 | |
| 27 namespace internal { | |
| 28 template <class NestedType> | |
| 29 class RepeatedMessageConverter; | |
| 30 } // namespace internal | |
| 31 } // namespace base | |
| 32 | |
| 33 // TODO(kochi): Rename to namespace drive. http://crbug.com/136371 | |
| 34 namespace gdata { | |
| 35 | |
| 36 // About resource represents the account information about the current user. | |
| 37 // https://developers.google.com/drive/v2/reference/about | |
| 38 class AboutResource { | |
| 39 public: | |
| 40 ~AboutResource(); | |
| 41 | |
| 42 // Registers the mapping between JSON field names and the members in this | |
| 43 // class. | |
| 44 static void RegisterJSONConverter( | |
| 45 base::JSONValueConverter<AboutResource>* converter); | |
| 46 | |
| 47 // Creates about resource from parsed JSON. | |
| 48 static scoped_ptr<AboutResource> CreateFrom(const base::Value& value); | |
| 49 | |
| 50 // Returns the largest change ID number. | |
| 51 int64 largest_change_id() const { return largest_change_id_; } | |
| 52 // Returns total number of quta bytes. | |
| 53 int64 quota_bytes_total() const { return quota_bytes_total_; } | |
| 54 // Returns the number of quota bytes used. | |
| 55 int64 quota_bytes_used() const { return quota_bytes_used_; } | |
| 56 // Returns root folder ID. | |
| 57 const std::string& root_folder_id() const { return root_folder_id_; } | |
| 58 | |
| 59 private: | |
| 60 friend class DriveAPIParserTest; | |
| 61 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, AboutResourceParser); | |
| 62 AboutResource(); | |
| 63 | |
| 64 // Parses and initializes data members from content of |value|. | |
| 65 // Return false if parsing fails. | |
| 66 bool Parse(const base::Value& value); | |
| 67 | |
| 68 int64 largest_change_id_; | |
| 69 int64 quota_bytes_total_; | |
| 70 int64 quota_bytes_used_; | |
| 71 std::string root_folder_id_; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(AboutResource); | |
| 74 }; | |
| 75 | |
| 76 // DriveAppIcon represents an icon for Drive Application. | |
| 77 // https://developers.google.com/drive/v2/reference/apps/list | |
| 78 class DriveAppIcon { | |
| 79 public: | |
| 80 enum IconCategory { | |
| 81 UNKNOWN, // Uninitialized state | |
| 82 DOCUMENT, // Document icon for various MIME types | |
| 83 APPLICATION, // Application icon for various MIME types | |
| 84 SHARED_DOCUMENT, // Icon for documents that are shared from other users. | |
| 85 }; | |
| 86 | |
| 87 ~DriveAppIcon(); | |
| 88 | |
| 89 // Registers the mapping between JSON field names and the members in this | |
| 90 // class. | |
| 91 static void RegisterJSONConverter( | |
| 92 base::JSONValueConverter<DriveAppIcon>* converter); | |
| 93 | |
| 94 // Creates drive app icon instance from parsed JSON. | |
| 95 static scoped_ptr<DriveAppIcon> CreateFrom(const base::Value& value); | |
| 96 | |
| 97 // Category of the icon. | |
| 98 IconCategory category() const { return category_; } | |
| 99 | |
| 100 // Size in pixels of one side of the icon (icons are always square). | |
| 101 const int icon_side_length() const { return icon_side_length_; } | |
| 102 | |
| 103 // Returns URL for this icon. | |
| 104 const GURL& icon_url() const { return icon_url_; } | |
| 105 | |
| 106 private: | |
| 107 // Parses and initializes data members from content of |value|. | |
| 108 // Return false if parsing fails. | |
| 109 bool Parse(const base::Value& value); | |
| 110 | |
| 111 // Extracts the icon category from the given string. Returns false and does | |
| 112 // not change |result| when |scheme| has an unrecognizable value. | |
| 113 static bool GetIconCategory(const base::StringPiece& category, | |
| 114 IconCategory* result); | |
| 115 | |
| 116 friend class base::internal::RepeatedMessageConverter<DriveAppIcon>; | |
| 117 friend class AppResource; | |
| 118 DriveAppIcon(); | |
| 119 | |
| 120 IconCategory category_; | |
| 121 int icon_side_length_; | |
| 122 GURL icon_url_; | |
| 123 | |
| 124 DISALLOW_COPY_AND_ASSIGN(DriveAppIcon); | |
| 125 }; | |
| 126 | |
| 127 // AppResource represents a Drive Application. | |
| 128 // https://developers.google.com/drive/v2/reference/apps/list | |
| 129 class AppResource { | |
| 130 public: | |
| 131 ~AppResource(); | |
| 132 | |
| 133 // Registers the mapping between JSON field names and the members in this | |
| 134 // class. | |
| 135 static void RegisterJSONConverter( | |
| 136 base::JSONValueConverter<AppResource>* converter); | |
| 137 | |
| 138 // Creates app resource from parsed JSON. | |
| 139 static scoped_ptr<AppResource> CreateFrom(const base::Value& value); | |
| 140 | |
| 141 // Returns application ID, which is 12-digit decimals (e.g. "123456780123"). | |
| 142 const std::string& application_id() const { return application_id_; } | |
| 143 | |
| 144 // Returns application name. | |
| 145 const std::string& name() const { return name_; } | |
| 146 | |
| 147 // Returns the name of the type of object this application creates. | |
| 148 // This is used for displaying in "Create" menu item for this app. | |
| 149 // If empty, application name is used instead. | |
| 150 const std::string& object_type() const { return object_type_; } | |
| 151 | |
| 152 // Returns whether this application suuports creating new objects. | |
| 153 bool supports_create() const { return supports_create_; } | |
| 154 | |
| 155 // Returns whether this application supports importing Google Docs. | |
| 156 bool supports_import() const { return supports_import_; } | |
| 157 | |
| 158 // Returns whether this application is installed. | |
| 159 bool is_installed() const { return installed_; } | |
| 160 | |
| 161 // Returns whether this application is authorized to access data on the | |
| 162 // user's Drive. | |
| 163 bool is_authorized() const { return authorized_; } | |
| 164 | |
| 165 // Returns the product URL, e.g. at Chrmoe Web Store. | |
| 166 const GURL& product_url() const { return product_url_; } | |
| 167 | |
| 168 // List of primary mime types supported by this WebApp. Primary status should | |
| 169 // trigger this WebApp becoming the default handler of file instances that | |
| 170 // have these mime types. | |
| 171 const ScopedVector<std::string>& primary_mimetypes() const { | |
| 172 return primary_mimetypes_; | |
| 173 } | |
| 174 | |
| 175 // List of secondary mime types supported by this WebApp. Secondary status | |
| 176 // should make this WebApp show up in "Open with..." pop-up menu of the | |
| 177 // default action menu for file with matching mime types. | |
| 178 const ScopedVector<std::string>& secondary_mimetypes() const { | |
| 179 return secondary_mimetypes_; | |
| 180 } | |
| 181 | |
| 182 // List of primary file extensions supported by this WebApp. Primary status | |
| 183 // should trigger this WebApp becoming the default handler of file instances | |
| 184 // that match these extensions. | |
| 185 const ScopedVector<std::string>& primary_file_extensions() const { | |
| 186 return primary_file_extensions_; | |
| 187 } | |
| 188 | |
| 189 // List of secondary file extensions supported by this WebApp. Secondary | |
| 190 // status should make this WebApp show up in "Open with..." pop-up menu of the | |
| 191 // default action menu for file with matching extensions. | |
| 192 const ScopedVector<std::string>& secondary_file_extensions() const { | |
| 193 return secondary_file_extensions_; | |
| 194 } | |
| 195 | |
| 196 // Returns Icons for this application. An application can have multiple | |
| 197 // icons for different purpose (application, document, shared document) | |
| 198 // in several sizes. | |
| 199 const ScopedVector<DriveAppIcon>& icons() const { | |
| 200 return icons_; | |
| 201 } | |
| 202 | |
| 203 private: | |
| 204 friend class base::internal::RepeatedMessageConverter<AppResource>; | |
| 205 friend class AppList; | |
| 206 AppResource(); | |
| 207 | |
| 208 // Parses and initializes data members from content of |value|. | |
| 209 // Return false if parsing fails. | |
| 210 bool Parse(const base::Value& value); | |
| 211 | |
| 212 std::string application_id_; | |
| 213 std::string name_; | |
| 214 std::string object_type_; | |
| 215 bool supports_create_; | |
| 216 bool supports_import_; | |
| 217 bool installed_; | |
| 218 bool authorized_; | |
| 219 GURL product_url_; | |
| 220 ScopedVector<std::string> primary_mimetypes_; | |
| 221 ScopedVector<std::string> secondary_mimetypes_; | |
| 222 ScopedVector<std::string> primary_file_extensions_; | |
| 223 ScopedVector<std::string> secondary_file_extensions_; | |
| 224 ScopedVector<DriveAppIcon> icons_; | |
| 225 | |
| 226 DISALLOW_COPY_AND_ASSIGN(AppResource); | |
| 227 }; | |
| 228 | |
| 229 // AppList represents a list of Drive Applications. | |
| 230 // https://developers.google.com/drive/v2/reference/apps/list | |
| 231 class AppList { | |
| 232 public: | |
| 233 ~AppList(); | |
| 234 | |
| 235 // Registers the mapping between JSON field names and the members in this | |
| 236 // class. | |
| 237 static void RegisterJSONConverter( | |
| 238 base::JSONValueConverter<AppList>* converter); | |
| 239 | |
| 240 // Creates app list from parsed JSON. | |
| 241 static scoped_ptr<AppList> CreateFrom(const base::Value& value); | |
| 242 | |
| 243 // ETag for this resource. | |
| 244 const std::string& etag() const { return etag_; } | |
| 245 | |
| 246 // Returns a vector of applications. | |
| 247 const ScopedVector<AppResource>& items() const { return items_; } | |
| 248 | |
| 249 private: | |
| 250 friend class DriveAPIParserTest; | |
| 251 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, AppListParser); | |
| 252 AppList(); | |
| 253 | |
| 254 // Parses and initializes data members from content of |value|. | |
| 255 // Return false if parsing fails. | |
| 256 bool Parse(const base::Value& value); | |
| 257 | |
| 258 std::string etag_; | |
| 259 ScopedVector<AppResource> items_; | |
| 260 | |
| 261 DISALLOW_COPY_AND_ASSIGN(AppList); | |
| 262 }; | |
| 263 | |
| 264 // ParentReference represents a directory. | |
| 265 // https://developers.google.com/drive/v2/reference/parents | |
| 266 class ParentReference { | |
| 267 public: | |
| 268 ~ParentReference(); | |
| 269 | |
| 270 // Registers the mapping between JSON field names and the members in this | |
| 271 // class. | |
| 272 static void RegisterJSONConverter( | |
| 273 base::JSONValueConverter<ParentReference>* converter); | |
| 274 | |
| 275 // Creates parent reference from parsed JSON. | |
| 276 static scoped_ptr<ParentReference> CreateFrom(const base::Value& value); | |
| 277 | |
| 278 // Returns the file id of the reference. | |
| 279 const std::string& file_id() const { return file_id_; } | |
| 280 | |
| 281 // Returns the URL for the parent in Drive. | |
| 282 const GURL& parent_link() const { return parent_link_; } | |
| 283 | |
| 284 // Returns true if the reference is root directory. | |
| 285 bool is_root() const { return is_root_; } | |
| 286 | |
| 287 private: | |
| 288 friend class base::internal::RepeatedMessageConverter<ParentReference>; | |
| 289 ParentReference(); | |
| 290 | |
| 291 // Parses and initializes data members from content of |value|. | |
| 292 // Return false if parsing fails. | |
| 293 bool Parse(const base::Value& value); | |
| 294 | |
| 295 std::string file_id_; | |
| 296 GURL parent_link_; | |
| 297 bool is_root_; | |
| 298 | |
| 299 DISALLOW_COPY_AND_ASSIGN(ParentReference); | |
| 300 }; | |
| 301 | |
| 302 // FileLabels represents labels for file or folder. | |
| 303 // https://developers.google.com/drive/v2/reference/files | |
| 304 class FileLabels { | |
| 305 public: | |
| 306 ~FileLabels(); | |
| 307 | |
| 308 // Registers the mapping between JSON field names and the members in this | |
| 309 // class. | |
| 310 static void RegisterJSONConverter( | |
| 311 base::JSONValueConverter<FileLabels>* converter); | |
| 312 | |
| 313 // Creates about resource from parsed JSON. | |
| 314 static scoped_ptr<FileLabels> CreateFrom(const base::Value& value); | |
| 315 | |
| 316 // Whether this file is starred by the user. | |
| 317 bool is_starred() const { return starred_; } | |
| 318 // Whether this file is hidden from the user. | |
| 319 bool is_hidden() const { return hidden_; } | |
| 320 // Whether this file has been trashed. | |
| 321 bool is_trashed() const { return trashed_; } | |
| 322 // Whether viewers are prevented from downloading this file. | |
| 323 bool is_restricted() const { return restricted_; } | |
| 324 // Whether this file has been viewed by this user. | |
| 325 bool is_viewed() const { return viewed_; } | |
| 326 | |
| 327 private: | |
| 328 friend class FileResource; | |
| 329 FileLabels(); | |
| 330 | |
| 331 // Parses and initializes data members from content of |value|. | |
| 332 // Return false if parsing fails. | |
| 333 bool Parse(const base::Value& value); | |
| 334 | |
| 335 bool starred_; | |
| 336 bool hidden_; | |
| 337 bool trashed_; | |
| 338 bool restricted_; | |
| 339 bool viewed_; | |
| 340 | |
| 341 DISALLOW_COPY_AND_ASSIGN(FileLabels); | |
| 342 }; | |
| 343 | |
| 344 // FileResource represents a file or folder metadata in Drive. | |
| 345 // https://developers.google.com/drive/v2/reference/files | |
| 346 class FileResource { | |
| 347 public: | |
| 348 ~FileResource(); | |
| 349 | |
| 350 // Registers the mapping between JSON field names and the members in this | |
| 351 // class. | |
| 352 static void RegisterJSONConverter( | |
| 353 base::JSONValueConverter<FileResource>* converter); | |
| 354 | |
| 355 // Creates file resource from parsed JSON. | |
| 356 static scoped_ptr<FileResource> CreateFrom(const base::Value& value); | |
| 357 | |
| 358 // Returns true if this is a directory. | |
| 359 // Note: "folder" is used elsewhere in this file to match Drive API reference, | |
| 360 // but outside this file we use "directory" to match HTML5 filesystem API. | |
| 361 bool IsDirectory() const; | |
| 362 | |
| 363 // Returns EntryKind for this file. | |
| 364 // TODO(kochi): Remove this once FileResource is directly converted to proto. | |
| 365 // http://crbug.com/142293 | |
| 366 DocumentEntry::EntryKind GetKind() const; | |
| 367 | |
| 368 // Returns file ID. This is unique in all files in Google Drive. | |
| 369 const std::string& file_id() const { return file_id_; } | |
| 370 | |
| 371 // Returns ETag for this file. | |
| 372 const std::string& etag() const { return etag_; } | |
| 373 | |
| 374 // Returns the link to JSON of this file itself. | |
| 375 const GURL& self_link() const { return self_link_; } | |
| 376 | |
| 377 // Returns the title of this file. | |
| 378 const std::string& title() const { return title_; } | |
| 379 | |
| 380 // Returns MIME type of this file. | |
| 381 const std::string& mime_type() const { return mime_type_; } | |
| 382 | |
| 383 // Returns labels for this file. | |
| 384 const FileLabels& labels() const { return labels_; } | |
| 385 | |
| 386 // Returns created time of this file. | |
| 387 const base::Time& created_date() const { return created_date_; } | |
| 388 | |
| 389 // Returns modification time by the user. | |
| 390 const base::Time& modified_by_me_date() const { return modified_by_me_date_; } | |
| 391 | |
| 392 // Returns the short-lived download URL for the file. This field exists | |
| 393 // only when the file content is stored in Drive. | |
| 394 const GURL& download_url() const { return download_url_; } | |
| 395 | |
| 396 // Returns the extension part of the filename. | |
| 397 const std::string& file_extension() const { return file_extension_; } | |
| 398 | |
| 399 // Returns MD5 checksum of this file. | |
| 400 const std::string& md5_checksum() const { return md5_checksum_; } | |
| 401 | |
| 402 // Returns the size of this file in bytes. | |
| 403 int64 file_size() const { return file_size_; } | |
| 404 | |
| 405 // Return the link to open the file in Google editor or viewer. | |
| 406 // E.g. Google Document, Google Spreadsheet. | |
| 407 const GURL& alternate_link() const { return alternate_link_; } | |
| 408 | |
| 409 // Returns the link for embedding the file. | |
| 410 const GURL& embed_link() const { return embed_link_; } | |
| 411 | |
| 412 // Returns parent references (directories) of this file. | |
| 413 const ScopedVector<ParentReference>& parents() const { return parents_; } | |
| 414 | |
| 415 // Returns the link to the file's thumbnail. | |
| 416 const GURL& thumbnail_link() const { return thumbnail_link_; } | |
| 417 | |
| 418 // Returns the link to open its downloadable content, using cookie based | |
| 419 // authentication. | |
| 420 const GURL& web_content_link() const { return web_content_link_; } | |
| 421 | |
| 422 private: | |
| 423 friend class base::internal::RepeatedMessageConverter<FileResource>; | |
| 424 friend class ChangeResource; | |
| 425 friend class FileList; | |
| 426 FileResource(); | |
| 427 | |
| 428 // Parses and initializes data members from content of |value|. | |
| 429 // Return false if parsing fails. | |
| 430 bool Parse(const base::Value& value); | |
| 431 | |
| 432 std::string file_id_; | |
| 433 std::string etag_; | |
| 434 GURL self_link_; | |
| 435 std::string title_; | |
| 436 std::string mime_type_; | |
| 437 FileLabels labels_; | |
| 438 base::Time created_date_; | |
| 439 base::Time modified_by_me_date_; | |
| 440 GURL download_url_; | |
| 441 std::string file_extension_; | |
| 442 std::string md5_checksum_; | |
| 443 int64 file_size_; | |
| 444 GURL alternate_link_; | |
| 445 GURL embed_link_; | |
| 446 ScopedVector<ParentReference> parents_; | |
| 447 GURL thumbnail_link_; | |
| 448 GURL web_content_link_; | |
| 449 | |
| 450 DISALLOW_COPY_AND_ASSIGN(FileResource); | |
| 451 }; | |
| 452 | |
| 453 // FileList represents a collection of files and folders. | |
| 454 // https://developers.google.com/drive/v2/reference/files/list | |
| 455 class FileList { | |
| 456 public: | |
| 457 ~FileList(); | |
| 458 | |
| 459 // Registers the mapping between JSON field names and the members in this | |
| 460 // class. | |
| 461 static void RegisterJSONConverter( | |
| 462 base::JSONValueConverter<FileList>* converter); | |
| 463 | |
| 464 // Creates file list from parsed JSON. | |
| 465 static scoped_ptr<FileList> CreateFrom(const base::Value& value); | |
| 466 | |
| 467 // Returns the ETag of the list. | |
| 468 const std::string& etag() const { return etag_; } | |
| 469 | |
| 470 // Returns the page token for the next page of files, if the list is large | |
| 471 // to fit in one response. If this is empty, there is no more file lists. | |
| 472 const std::string& next_page_token() const { return next_page_token_; } | |
| 473 | |
| 474 // Returns a link to the next page of files. The URL includes the next page | |
| 475 // token. | |
| 476 const GURL& next_link() const { return next_link_; } | |
| 477 | |
| 478 // Returns a set of files in this list. | |
| 479 const ScopedVector<FileResource>& items() const { return items_; } | |
| 480 | |
| 481 private: | |
| 482 friend class DriveAPIParserTest; | |
| 483 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, FileListParser); | |
| 484 FileList(); | |
| 485 | |
| 486 // Parses and initializes data members from content of |value|. | |
| 487 // Return false if parsing fails. | |
| 488 bool Parse(const base::Value& value); | |
| 489 | |
| 490 std::string etag_; | |
| 491 std::string next_page_token_; | |
| 492 GURL next_link_; | |
| 493 ScopedVector<FileResource> items_; | |
| 494 | |
| 495 DISALLOW_COPY_AND_ASSIGN(FileList); | |
| 496 }; | |
| 497 | |
| 498 // ChangeResource represents a change in a file. | |
| 499 // https://developers.google.com/drive/v2/reference/changes | |
| 500 class ChangeResource { | |
| 501 public: | |
| 502 ~ChangeResource(); | |
| 503 | |
| 504 // Registers the mapping between JSON field names and the members in this | |
| 505 // class. | |
| 506 static void RegisterJSONConverter( | |
| 507 base::JSONValueConverter<ChangeResource>* converter); | |
| 508 | |
| 509 // Creates change resource from parsed JSON. | |
| 510 static scoped_ptr<ChangeResource> CreateFrom(const base::Value& value); | |
| 511 | |
| 512 // Returns change ID for this change. This is a monotonically increasing | |
| 513 // number. | |
| 514 int64 change_id() const { return change_id_; } | |
| 515 | |
| 516 // Returns a string file ID for corresponding file of the change. | |
| 517 const std::string& file_id() const { return file_id_; } | |
| 518 | |
| 519 // Returns true if this file is deleted in the change. | |
| 520 bool is_deleted() const { return deleted_; } | |
| 521 | |
| 522 // Returns FileResource of the file which the change refers to. | |
| 523 const FileResource& file() const { return file_; } | |
| 524 | |
| 525 private: | |
| 526 friend class base::internal::RepeatedMessageConverter<ChangeResource>; | |
| 527 friend class ChangeList; | |
| 528 ChangeResource(); | |
| 529 | |
| 530 // Parses and initializes data members from content of |value|. | |
| 531 // Return false if parsing fails. | |
| 532 bool Parse(const base::Value& value); | |
| 533 | |
| 534 int64 change_id_; | |
| 535 std::string file_id_; | |
| 536 bool deleted_; | |
| 537 FileResource file_; | |
| 538 | |
| 539 DISALLOW_COPY_AND_ASSIGN(ChangeResource); | |
| 540 }; | |
| 541 | |
| 542 // ChangeList represents a set of changes in the drive. | |
| 543 // https://developers.google.com/drive/v2/reference/changes/list | |
| 544 class ChangeList { | |
| 545 public: | |
| 546 ~ChangeList(); | |
| 547 | |
| 548 // Registers the mapping between JSON field names and the members in this | |
| 549 // class. | |
| 550 static void RegisterJSONConverter( | |
| 551 base::JSONValueConverter<ChangeList>* converter); | |
| 552 | |
| 553 // Creates change list from parsed JSON. | |
| 554 static scoped_ptr<ChangeList> CreateFrom(const base::Value& value); | |
| 555 | |
| 556 // Returns the ETag of the list. | |
| 557 const std::string& etag() const { return etag_; } | |
| 558 | |
| 559 // Returns the page token for the next page of files, if the list is large | |
| 560 // to fit in one response. If this is empty, there is no more file lists. | |
| 561 const std::string& next_page_token() const { return next_page_token_; } | |
| 562 | |
| 563 // Returns a link to the next page of files. The URL includes the next page | |
| 564 // token. | |
| 565 const GURL& next_link() const { return next_link_; } | |
| 566 | |
| 567 // Returns the largest change ID number. | |
| 568 int64 largest_change_id() const { return largest_change_id_; } | |
| 569 | |
| 570 // Returns a set of changes in this list. | |
| 571 const ScopedVector<ChangeResource>& items() const { return items_; } | |
| 572 | |
| 573 private: | |
| 574 friend class DriveAPIParserTest; | |
| 575 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, ChangeListParser); | |
| 576 ChangeList(); | |
| 577 | |
| 578 // Parses and initializes data members from content of |value|. | |
| 579 // Return false if parsing fails. | |
| 580 bool Parse(const base::Value& value); | |
| 581 | |
| 582 std::string etag_; | |
| 583 std::string next_page_token_; | |
| 584 GURL next_link_; | |
| 585 int64 largest_change_id_; | |
| 586 ScopedVector<ChangeResource> items_; | |
| 587 | |
| 588 DISALLOW_COPY_AND_ASSIGN(ChangeList); | |
| 589 }; | |
| 590 | |
| 591 } // namespace gdata | |
| 592 | |
| 593 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ | |
| OLD | NEW |