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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Base class for representing files and directories in gdata virtual file | 34 // Base class for representing files and directories in gdata virtual file |
35 // system. | 35 // system. |
36 class GDataEntry { | 36 class GDataEntry { |
37 public: | 37 public: |
38 virtual ~GDataEntry(); | 38 virtual ~GDataEntry(); |
39 | 39 |
40 virtual GDataFile* AsGDataFile(); | 40 virtual GDataFile* AsGDataFile(); |
41 virtual GDataDirectory* AsGDataDirectory(); | 41 virtual GDataDirectory* AsGDataDirectory(); |
42 | 42 |
43 // Initializes from DocumentEntry. | 43 // Initializes from DocumentEntry. |
44 virtual void InitFromDocumentEntry(DocumentEntry* doc); | 44 virtual void InitFromDocumentEntry(const DocumentEntry& doc); |
45 | 45 |
46 // const versions of AsGDataFile and AsGDataDirectory. | 46 // const versions of AsGDataFile and AsGDataDirectory. |
47 const GDataFile* AsGDataFileConst() const; | 47 const GDataFile* AsGDataFileConst() const; |
48 const GDataDirectory* AsGDataDirectoryConst() const; | 48 const GDataDirectory* AsGDataDirectoryConst() const; |
49 | 49 |
50 // Serialize/Parse to/from string via proto classes. | 50 // Serialize/Parse to/from string via proto classes. |
51 void SerializeToString(std::string* serialized_proto) const; | 51 void SerializeToString(std::string* serialized_proto) const; |
52 | 52 |
53 // Converts the proto representation to the platform file. | 53 // Converts the proto representation to the platform file. |
54 static void ConvertProtoToPlatformFileInfo( | 54 static void ConvertProtoToPlatformFileInfo( |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // Overrides GDataEntry::SetBaseNameFromTitle() to set |base_name_| based | 194 // Overrides GDataEntry::SetBaseNameFromTitle() to set |base_name_| based |
195 // on the value of |title_| as well as |is_hosted_document_| and | 195 // on the value of |title_| as well as |is_hosted_document_| and |
196 // |document_extension_| for hosted documents. | 196 // |document_extension_| for hosted documents. |
197 virtual void SetBaseNameFromTitle() OVERRIDE; | 197 virtual void SetBaseNameFromTitle() OVERRIDE; |
198 | 198 |
199 private: | 199 private: |
200 friend class GDataDirectoryService; // For access to ctor. | 200 friend class GDataDirectoryService; // For access to ctor. |
201 | 201 |
202 explicit GDataFile(GDataDirectoryService* directory_service); | 202 explicit GDataFile(GDataDirectoryService* directory_service); |
203 // Initializes from DocumentEntry. | 203 // Initializes from DocumentEntry. |
204 virtual void InitFromDocumentEntry(DocumentEntry* doc) OVERRIDE; | 204 virtual void InitFromDocumentEntry(const DocumentEntry& doc) OVERRIDE; |
205 | 205 |
206 virtual GDataFile* AsGDataFile() OVERRIDE; | 206 virtual GDataFile* AsGDataFile() OVERRIDE; |
207 | 207 |
208 DocumentEntry::EntryKind kind_; // Not saved in proto. | 208 DocumentEntry::EntryKind kind_; // Not saved in proto. |
209 GURL thumbnail_url_; | 209 GURL thumbnail_url_; |
210 GURL alternate_url_; | 210 GURL alternate_url_; |
211 std::string content_mime_type_; | 211 std::string content_mime_type_; |
212 std::string file_md5_; | 212 std::string file_md5_; |
213 std::string document_extension_; | 213 std::string document_extension_; |
214 bool is_hosted_document_; | 214 bool is_hosted_document_; |
(...skipping 21 matching lines...) Expand all Loading... |
236 } | 236 } |
237 | 237 |
238 private: | 238 private: |
239 // TODO(satorux): Remove the friend statements. crbug.com/139649 | 239 // TODO(satorux): Remove the friend statements. crbug.com/139649 |
240 friend class GDataDirectoryService; | 240 friend class GDataDirectoryService; |
241 friend class GDataWapiFeedProcessor; | 241 friend class GDataWapiFeedProcessor; |
242 | 242 |
243 explicit GDataDirectory(GDataDirectoryService* directory_service); | 243 explicit GDataDirectory(GDataDirectoryService* directory_service); |
244 | 244 |
245 // Initializes from DocumentEntry. | 245 // Initializes from DocumentEntry. |
246 virtual void InitFromDocumentEntry(DocumentEntry* doc) OVERRIDE; | 246 virtual void InitFromDocumentEntry(const DocumentEntry& doc) OVERRIDE; |
247 | 247 |
248 virtual GDataDirectory* AsGDataDirectory() OVERRIDE; | 248 virtual GDataDirectory* AsGDataDirectory() OVERRIDE; |
249 | 249 |
250 // Adds child file to the directory and takes over the ownership of |file| | 250 // Adds child file to the directory and takes over the ownership of |file| |
251 // object. The method will also do name de-duplication to ensure that the | 251 // object. The method will also do name de-duplication to ensure that the |
252 // exposed presentation path does not have naming conflicts. Two files with | 252 // exposed presentation path does not have naming conflicts. Two files with |
253 // the same name "Foo" will be renames to "Foo (1)" and "Foo (2)". | 253 // the same name "Foo" will be renames to "Foo (1)" and "Foo (2)". |
254 // TODO(satorux): Remove this. crbug.com/139649 | 254 // TODO(satorux): Remove this. crbug.com/139649 |
255 void AddEntry(GDataEntry* entry); | 255 void AddEntry(GDataEntry* entry); |
256 | 256 |
(...skipping 24 matching lines...) Expand all Loading... |
281 // Collection of children GDataEntry items. | 281 // Collection of children GDataEntry items. |
282 GDataFileCollection child_files_; | 282 GDataFileCollection child_files_; |
283 GDataDirectoryCollection child_directories_; | 283 GDataDirectoryCollection child_directories_; |
284 | 284 |
285 DISALLOW_COPY_AND_ASSIGN(GDataDirectory); | 285 DISALLOW_COPY_AND_ASSIGN(GDataDirectory); |
286 }; | 286 }; |
287 | 287 |
288 } // namespace gdata | 288 } // namespace gdata |
289 | 289 |
290 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ | 290 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
OLD | NEW |