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 if the entry is not bound to any file system (i.e. doesn't have a root |
| 142 // directory set). E.g. |fake_search_directory| below. |
| 143 // NOTE: GDataRootDirectories will return true here, since they have |
| 144 // themselves as root directories. |
| 145 bool is_detached() const { return root_ == NULL; } |
| 146 |
141 // Returns virtual file path representing this file system entry. This path | 147 // Returns virtual file path representing this file system entry. This path |
142 // corresponds to file path expected by public methods of GDataFileSyste | 148 // corresponds to file path expected by public methods of GDataFileSyste |
143 // class. | 149 // class. |
144 FilePath GetFilePath() const; | 150 FilePath GetFilePath() const; |
145 | 151 |
146 // Sets |file_name_| based on the value of |title_| without name | 152 // Sets |file_name_| based on the value of |title_| without name |
147 // de-duplication (see AddEntry() for details on de-duplication). | 153 // de-duplication (see AddEntry() for details on de-duplication). |
148 virtual void SetFileNameFromTitle(); | 154 virtual void SetFileNameFromTitle(); |
149 | 155 |
150 protected: | 156 protected: |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 495 |
490 // Serializes/Parses to/from string via proto classes. | 496 // Serializes/Parses to/from string via proto classes. |
491 void SerializeToString(std::string* serialized_proto) const; | 497 void SerializeToString(std::string* serialized_proto) const; |
492 bool ParseFromString(const std::string& serialized_proto); | 498 bool ParseFromString(const std::string& serialized_proto); |
493 | 499 |
494 // Converts to/from proto. | 500 // Converts to/from proto. |
495 void FromProto(const GDataRootDirectoryProto& proto); | 501 void FromProto(const GDataRootDirectoryProto& proto); |
496 void ToProto(GDataRootDirectoryProto* proto) const; | 502 void ToProto(GDataRootDirectoryProto* proto) const; |
497 | 503 |
498 private: | 504 private: |
| 505 // Used in |FindEntryByPath| if the path that is being searched for is |
| 506 // pointing to a search result path. The find path parameters should be |
| 507 // modified to point to the actual file system entry bound to the search |
| 508 // result. |
| 509 bool ModifyFindEntryParamsIfSearchPath( |
| 510 const FilePath& file_path, |
| 511 std::vector<FilePath::StringType>* components, |
| 512 GDataDirectory** current_dir, |
| 513 FilePath* directory_path); |
| 514 |
499 ResourceMap resource_map_; | 515 ResourceMap resource_map_; |
500 CacheMap cache_map_; | 516 CacheMap cache_map_; |
501 | 517 |
| 518 // Fake directory that will be returned when searching for content search |
| 519 // paths to make file manager happy when resolving paths. This directory |
| 520 // should never be used for file operations or storing file entries. |
| 521 scoped_ptr<GDataDirectory> fake_search_directory_; |
| 522 |
502 base::Time last_serialized_; | 523 base::Time last_serialized_; |
503 int largest_changestamp_; | 524 int largest_changestamp_; |
504 size_t serialized_size_; | 525 size_t serialized_size_; |
505 | 526 |
506 DISALLOW_COPY_AND_ASSIGN(GDataRootDirectory); | 527 DISALLOW_COPY_AND_ASSIGN(GDataRootDirectory); |
507 }; | 528 }; |
508 | 529 |
509 } // namespace gdata | 530 } // namespace gdata |
510 | 531 |
511 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ | 532 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
OLD | NEW |