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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // class. | 268 // class. |
269 static void RegisterJSONConverter( | 269 static void RegisterJSONConverter( |
270 base::JSONValueConverter<ParentReference>* converter); | 270 base::JSONValueConverter<ParentReference>* converter); |
271 | 271 |
272 // Creates parent reference from parsed JSON. | 272 // Creates parent reference from parsed JSON. |
273 static scoped_ptr<ParentReference> CreateFrom(const base::Value& value); | 273 static scoped_ptr<ParentReference> CreateFrom(const base::Value& value); |
274 | 274 |
275 // Returns the file id of the reference. | 275 // Returns the file id of the reference. |
276 const std::string& file_id() const { return file_id_; } | 276 const std::string& file_id() const { return file_id_; } |
277 | 277 |
| 278 // Returns the URL for the parent in Drive. |
| 279 const GURL& parent_link() const { return parent_link_; } |
| 280 |
278 // Returns true if the reference is root directory. | 281 // Returns true if the reference is root directory. |
279 bool is_root() const { return is_root_; } | 282 bool is_root() const { return is_root_; } |
280 | 283 |
281 private: | 284 private: |
282 friend class base::internal::RepeatedMessageConverter<ParentReference>; | 285 friend class base::internal::RepeatedMessageConverter<ParentReference>; |
283 ParentReference(); | 286 ParentReference(); |
284 | 287 |
285 // Parses and initializes data members from content of |value|. | 288 // Parses and initializes data members from content of |value|. |
286 // Return false if parsing fails. | 289 // Return false if parsing fails. |
287 bool Parse(const base::Value& value); | 290 bool Parse(const base::Value& value); |
288 | 291 |
289 std::string file_id_; | 292 std::string file_id_; |
| 293 GURL parent_link_; |
290 bool is_root_; | 294 bool is_root_; |
291 | 295 |
292 DISALLOW_COPY_AND_ASSIGN(ParentReference); | 296 DISALLOW_COPY_AND_ASSIGN(ParentReference); |
293 }; | 297 }; |
294 | 298 |
295 // FileResource represents a file or folder metadata in Drive. | 299 // FileResource represents a file or folder metadata in Drive. |
296 // https://developers.google.com/drive/v2/reference/files | 300 // https://developers.google.com/drive/v2/reference/files |
297 class FileResource { | 301 class FileResource { |
298 public: | 302 public: |
299 ~FileResource(); | 303 ~FileResource(); |
(...skipping 16 matching lines...) Expand all Loading... |
316 | 320 |
317 // Returns ETag for this file. | 321 // Returns ETag for this file. |
318 const std::string& etag() const { return etag_; } | 322 const std::string& etag() const { return etag_; } |
319 | 323 |
320 // Returns MIME type of this file. | 324 // Returns MIME type of this file. |
321 const std::string& mime_type() const { return mime_type_; } | 325 const std::string& mime_type() const { return mime_type_; } |
322 | 326 |
323 // Returns the title of this file. | 327 // Returns the title of this file. |
324 const std::string& title() const { return title_; } | 328 const std::string& title() const { return title_; } |
325 | 329 |
| 330 // Returns created time of this file. |
| 331 const base::Time& created_date() const { return created_date_; } |
| 332 |
326 // Returns modification time by the user. | 333 // Returns modification time by the user. |
327 const base::Time& modified_by_me_date() const { return modified_by_me_date_; } | 334 const base::Time& modified_by_me_date() const { return modified_by_me_date_; } |
328 | 335 |
329 // Returns parent references (directories) of this file. | 336 // Returns parent references (directories) of this file. |
330 const ScopedVector<ParentReference>& parents() const { return parents_; } | 337 const ScopedVector<ParentReference>& parents() const { return parents_; } |
331 | 338 |
332 // Returns the download URL. | |
333 const GURL& download_url() const { return download_url_; } | |
334 | |
335 // Returns the extension part of the filename. | 339 // Returns the extension part of the filename. |
336 const std::string& file_extension() const { return file_extension_; } | 340 const std::string& file_extension() const { return file_extension_; } |
337 | 341 |
338 // Returns MD5 checksum of this file. | 342 // Returns MD5 checksum of this file. |
339 const std::string& md5_checksum() const { return md5_checksum_; } | 343 const std::string& md5_checksum() const { return md5_checksum_; } |
340 | 344 |
341 // Returns the size of this file in bytes. | 345 // Returns the size of this file in bytes. |
342 int64 file_size() const { return file_size_; } | 346 int64 file_size() const { return file_size_; } |
343 | 347 |
| 348 // Returns the short-lived download URL for the file. This field exists |
| 349 // only when the file content is stored in Drive. |
| 350 const GURL& download_url() const { return download_url_; } |
| 351 |
| 352 // Returns the link to JSON of this file itself. |
| 353 const GURL& self_link() const { return self_link_; } |
| 354 |
| 355 // Return the link to open the file in Google editor or viewer. |
| 356 // E.g. Google Document, Google Spreadsheet. |
| 357 const GURL& alternate_link() const { return alternate_link_; } |
| 358 |
| 359 // Returns the link for embedding the file. |
| 360 const GURL& embed_link() const { return embed_link_; } |
| 361 |
| 362 // Returns the link to the file's thumbnail. |
| 363 const GURL& thumbnail_link() const { return thumbnail_link_; } |
| 364 |
| 365 // Returns the link to open its downloadable content, using cookie based |
| 366 // authentication. |
| 367 const GURL& web_content_link() const { return web_content_link_; } |
| 368 |
344 private: | 369 private: |
345 friend class base::internal::RepeatedMessageConverter<FileResource>; | 370 friend class base::internal::RepeatedMessageConverter<FileResource>; |
346 friend class ChangeResource; | 371 friend class ChangeResource; |
347 friend class FileList; | 372 friend class FileList; |
348 FileResource(); | 373 FileResource(); |
349 | 374 |
350 // Parses and initializes data members from content of |value|. | 375 // Parses and initializes data members from content of |value|. |
351 // Return false if parsing fails. | 376 // Return false if parsing fails. |
352 bool Parse(const base::Value& value); | 377 bool Parse(const base::Value& value); |
353 | 378 |
354 std::string file_id_; | 379 std::string file_id_; |
355 std::string etag_; | 380 std::string etag_; |
356 std::string mime_type_; | 381 std::string mime_type_; |
357 std::string title_; | 382 std::string title_; |
| 383 base::Time created_date_; |
358 base::Time modified_by_me_date_; | 384 base::Time modified_by_me_date_; |
359 ScopedVector<ParentReference> parents_; | 385 ScopedVector<ParentReference> parents_; |
360 GURL download_url_; | |
361 std::string file_extension_; | 386 std::string file_extension_; |
362 std::string md5_checksum_; | 387 std::string md5_checksum_; |
363 int64 file_size_; | 388 int64 file_size_; |
| 389 GURL download_url_; |
| 390 GURL self_link_; |
| 391 GURL alternate_link_; |
| 392 GURL embed_link_; |
| 393 GURL thumbnail_link_; |
| 394 GURL web_content_link_; |
364 | 395 |
365 DISALLOW_COPY_AND_ASSIGN(FileResource); | 396 DISALLOW_COPY_AND_ASSIGN(FileResource); |
366 }; | 397 }; |
367 | 398 |
368 // FileList represents a collection of files and folders. | 399 // FileList represents a collection of files and folders. |
369 // https://developers.google.com/drive/v2/reference/files/list | 400 // https://developers.google.com/drive/v2/reference/files/list |
370 class FileList { | 401 class FileList { |
371 public: | 402 public: |
372 ~FileList(); | 403 ~FileList(); |
373 | 404 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 GURL next_link_; | 530 GURL next_link_; |
500 int64 largest_change_id_; | 531 int64 largest_change_id_; |
501 ScopedVector<ChangeResource> items_; | 532 ScopedVector<ChangeResource> items_; |
502 | 533 |
503 DISALLOW_COPY_AND_ASSIGN(ChangeList); | 534 DISALLOW_COPY_AND_ASSIGN(ChangeList); |
504 }; | 535 }; |
505 | 536 |
506 } // namespace gdata | 537 } // namespace gdata |
507 | 538 |
508 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ | 539 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_ |
OLD | NEW |