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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 class FindEntryDelegate; | 27 class FindEntryDelegate; |
28 class GDataFile; | 28 class GDataFile; |
29 class GDataDirectory; | 29 class GDataDirectory; |
30 class GDataRootDirectory; | 30 class GDataRootDirectory; |
31 | 31 |
32 class GDataEntryProto; | 32 class GDataEntryProto; |
33 class GDataFileProto; | 33 class GDataFileProto; |
34 class GDataDirectoryProto; | 34 class GDataDirectoryProto; |
35 class GDataRootDirectoryProto; | 35 class GDataRootDirectoryProto; |
| 36 class PlatformFileInfoProto; |
36 | 37 |
37 // Directory content origin. | 38 // Directory content origin. |
38 enum ContentOrigin { | 39 enum ContentOrigin { |
39 UNINITIALIZED, | 40 UNINITIALIZED, |
40 // Directory content is currently loading from somewhere. needs to wait. | 41 // Directory content is currently loading from somewhere. needs to wait. |
41 INITIALIZING, | 42 INITIALIZING, |
42 // Directory content is initialized, but during refreshing. | 43 // Directory content is initialized, but during refreshing. |
43 REFRESHING, | 44 REFRESHING, |
44 // Directory content is initialized from disk cache. | 45 // Directory content is initialized from disk cache. |
45 FROM_CACHE, | 46 FROM_CACHE, |
(...skipping 28 matching lines...) Expand all Loading... |
74 DocumentEntry* doc, | 75 DocumentEntry* doc, |
75 GDataRootDirectory* root); | 76 GDataRootDirectory* root); |
76 | 77 |
77 // Serialize/Parse to/from string via proto classes. | 78 // Serialize/Parse to/from string via proto classes. |
78 // TODO(achuith): Correctly set up parent_ and root_ links in | 79 // TODO(achuith): Correctly set up parent_ and root_ links in |
79 // FromProtoString. | 80 // FromProtoString. |
80 void SerializeToString(std::string* serialized_proto) const; | 81 void SerializeToString(std::string* serialized_proto) const; |
81 static scoped_ptr<GDataEntry> FromProtoString( | 82 static scoped_ptr<GDataEntry> FromProtoString( |
82 const std::string& serialized_proto); | 83 const std::string& serialized_proto); |
83 | 84 |
| 85 // Converts the proto representation to the platform file. |
| 86 static void ConvertProtoToPlatformFileInfo( |
| 87 const PlatformFileInfoProto& proto, |
| 88 base::PlatformFileInfo* file_info); |
| 89 |
| 90 // Converts the platform file info to the proto representation. |
| 91 static void ConvertPlatformFileInfoToProto( |
| 92 const base::PlatformFileInfo& file_info, |
| 93 PlatformFileInfoProto* proto); |
| 94 |
84 // Converts to/from proto. | 95 // Converts to/from proto. |
85 void FromProto(const GDataEntryProto& proto); | 96 void FromProto(const GDataEntryProto& proto); |
86 void ToProto(GDataEntryProto* proto) const; | 97 void ToProto(GDataEntryProto* proto) const; |
87 | 98 |
88 // Escapes forward slashes from file names with magic unicode character | 99 // Escapes forward slashes from file names with magic unicode character |
89 // \u2215 pretty much looks the same in UI. | 100 // \u2215 pretty much looks the same in UI. |
90 static std::string EscapeUtf8FileName(const std::string& input); | 101 static std::string EscapeUtf8FileName(const std::string& input); |
91 | 102 |
92 // Unescapes what was escaped in EScapeUtf8FileName. | 103 // Unescapes what was escaped in EScapeUtf8FileName. |
93 static std::string UnescapeUtf8FileName(const std::string& input); | 104 static std::string UnescapeUtf8FileName(const std::string& input); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 base::Time last_serialized_; | 502 base::Time last_serialized_; |
492 int largest_changestamp_; | 503 int largest_changestamp_; |
493 size_t serialized_size_; | 504 size_t serialized_size_; |
494 | 505 |
495 DISALLOW_COPY_AND_ASSIGN(GDataRootDirectory); | 506 DISALLOW_COPY_AND_ASSIGN(GDataRootDirectory); |
496 }; | 507 }; |
497 | 508 |
498 } // namespace gdata | 509 } // namespace gdata |
499 | 510 |
500 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ | 511 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
OLD | NEW |