Chromium Code Reviews| 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_FILES_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 | 131 |
| 132 // The resource id of the parent folder. This piece of information is needed | 132 // The resource id of the parent folder. This piece of information is needed |
| 133 // to pair files from change feeds with their directory parents withing the | 133 // to pair files from change feeds with their directory parents withing the |
| 134 // existing file system snapshot (GDataRootDirectory::resource_map_). | 134 // existing file system snapshot (GDataRootDirectory::resource_map_). |
| 135 const std::string& parent_resource_id() const { return parent_resource_id_; } | 135 const std::string& parent_resource_id() const { return parent_resource_id_; } |
| 136 | 136 |
| 137 // True if file was deleted. Used only for instances that are generated from | 137 // True if file was deleted. Used only for instances that are generated from |
| 138 // delta feeds. | 138 // delta feeds. |
| 139 bool is_deleted() const { return deleted_; } | 139 bool is_deleted() const { return deleted_; } |
| 140 | 140 |
| 141 // True it the entry is not bound to any file system. | |
| 142 // E.g. |fake_search_directory| below. | |
|
satorux1
2012/05/03 17:58:34
What about GDataRootDirectory? What parent does it
tbarzic
2012/05/03 23:56:17
it doesn't have parents, but it has root_ (itself)
| |
| 143 bool is_detached() const { return root_ == NULL; } | |
| 144 | |
| 141 // Returns virtual file path representing this file system entry. This path | 145 // Returns virtual file path representing this file system entry. This path |
| 142 // corresponds to file path expected by public methods of GDataFileSyste | 146 // corresponds to file path expected by public methods of GDataFileSyste |
| 143 // class. | 147 // class. |
| 144 FilePath GetFilePath() const; | 148 FilePath GetFilePath() const; |
| 145 | 149 |
| 146 // Sets |file_name_| based on the value of |title_| without name | 150 // Sets |file_name_| based on the value of |title_| without name |
| 147 // de-duplication (see AddEntry() for details on de-duplication). | 151 // de-duplication (see AddEntry() for details on de-duplication). |
| 148 virtual void SetFileNameFromTitle(); | 152 virtual void SetFileNameFromTitle(); |
| 149 | 153 |
| 150 protected: | 154 protected: |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 | 493 |
| 490 // Serializes/Parses to/from string via proto classes. | 494 // Serializes/Parses to/from string via proto classes. |
| 491 void SerializeToString(std::string* serialized_proto) const; | 495 void SerializeToString(std::string* serialized_proto) const; |
| 492 bool ParseFromString(const std::string& serialized_proto); | 496 bool ParseFromString(const std::string& serialized_proto); |
| 493 | 497 |
| 494 // Converts to/from proto. | 498 // Converts to/from proto. |
| 495 void FromProto(const GDataRootDirectoryProto& proto); | 499 void FromProto(const GDataRootDirectoryProto& proto); |
| 496 void ToProto(GDataRootDirectoryProto* proto) const; | 500 void ToProto(GDataRootDirectoryProto* proto) const; |
| 497 | 501 |
| 498 private: | 502 private: |
| 503 // Used in |FindEntryByPath| if the path that is being searched for is | |
| 504 // pointing to a search result path. The find path parameters should be | |
| 505 // modified to point to the actual file system entry bound to the search | |
| 506 // result. | |
| 507 // Returns false only if the path is a search result path and the entry can't | |
| 508 // be found. | |
| 509 bool ModifyFindEntryParamsIfSearchPath( | |
| 510 const FilePath& file_path, | |
| 511 std::vector<FilePath::StringType>* components, | |
| 512 GDataDirectory** current_dir, | |
| 513 FilePath* directory_path, | |
| 514 GDataEntry** entry_to_return); | |
|
satorux1
2012/05/03 17:58:34
This function seems to do more than just modifying
tbarzic
2012/05/03 23:56:17
moved part of implementation to FindEntryByPath
| |
| 515 | |
| 499 ResourceMap resource_map_; | 516 ResourceMap resource_map_; |
| 500 CacheMap cache_map_; | 517 CacheMap cache_map_; |
| 501 | 518 |
| 519 // Fake directories that will be returned when searching for content search | |
| 520 // paths to make file manager happy when resolving paths. These directories | |
| 521 // should never be used for file operations or storing file entries. | |
| 522 scoped_ptr<GDataDirectory> fake_search_directory_; | |
| 523 scoped_ptr<GDataDirectory> fake_search_query_directory_; | |
|
satorux1
2012/05/03 17:58:34
What are the differences between the two directori
tbarzic
2012/05/03 23:56:17
there's only semantic difference.. I'll get rid of
| |
| 524 | |
| 502 base::Time last_serialized_; | 525 base::Time last_serialized_; |
| 503 int largest_changestamp_; | 526 int largest_changestamp_; |
| 504 size_t serialized_size_; | 527 size_t serialized_size_; |
| 505 | 528 |
| 506 DISALLOW_COPY_AND_ASSIGN(GDataRootDirectory); | 529 DISALLOW_COPY_AND_ASSIGN(GDataRootDirectory); |
| 507 }; | 530 }; |
| 508 | 531 |
| 509 } // namespace gdata | 532 } // namespace gdata |
| 510 | 533 |
| 511 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ | 534 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
| OLD | NEW |