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 <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const PlatformFileInfoProto& proto, | 56 const PlatformFileInfoProto& proto, |
57 base::PlatformFileInfo* file_info); | 57 base::PlatformFileInfo* file_info); |
58 | 58 |
59 // Converts the platform file info to the proto representation. | 59 // Converts the platform file info to the proto representation. |
60 static void ConvertPlatformFileInfoToProto( | 60 static void ConvertPlatformFileInfoToProto( |
61 const base::PlatformFileInfo& file_info, | 61 const base::PlatformFileInfo& file_info, |
62 PlatformFileInfoProto* proto); | 62 PlatformFileInfoProto* proto); |
63 | 63 |
64 // Converts to/from proto. Only handles the common part (i.e. does not | 64 // Converts to/from proto. Only handles the common part (i.e. does not |
65 // touch |file_specific_info|). | 65 // touch |file_specific_info|). |
66 bool FromProto(const GDataEntryProto& proto) WARN_UNUSED_RESULT; | 66 void FromProto(const GDataEntryProto& proto); |
67 // TODO(achuith,satorux): Should this be virtual? | 67 // TODO(achuith,satorux): Should this be virtual? |
68 void ToProto(GDataEntryProto* proto) const; | 68 void ToProto(GDataEntryProto* proto) const; |
69 | 69 |
70 // Similar to ToProto() but this fills in |file_specific_info| and | 70 // Similar to ToProto() but this fills in |file_specific_info| and |
71 // |directory_specific_info| based on the actual type of the entry. | 71 // |directory_specific_info| based on the actual type of the entry. |
72 // Used to obtain full metadata of a file or a directory as | 72 // Used to obtain full metadata of a file or a directory as |
73 // GDataEntryProto. | 73 // GDataEntryProto. |
74 void ToProtoFull(GDataEntryProto* proto) const; | 74 void ToProtoFull(GDataEntryProto* proto) const; |
75 | 75 |
76 // Escapes forward slashes from file names with magic unicode character | 76 // Escapes forward slashes from file names with magic unicode character |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 DISALLOW_COPY_AND_ASSIGN(GDataEntry); | 169 DISALLOW_COPY_AND_ASSIGN(GDataEntry); |
170 }; | 170 }; |
171 | 171 |
172 // Represents "file" in in a GData virtual file system. On gdata feed side, | 172 // Represents "file" in in a GData virtual file system. On gdata feed side, |
173 // this could be either a regular file or a server side document. | 173 // this could be either a regular file or a server side document. |
174 class GDataFile : public GDataEntry { | 174 class GDataFile : public GDataEntry { |
175 public: | 175 public: |
176 virtual ~GDataFile(); | 176 virtual ~GDataFile(); |
177 | 177 |
178 // Converts to/from proto. | 178 // Converts to/from proto. |
179 bool FromProto(const GDataEntryProto& proto) WARN_UNUSED_RESULT; | 179 void FromProto(const GDataEntryProto& proto); |
180 void ToProto(GDataEntryProto* proto) const; | 180 void ToProto(GDataEntryProto* proto) const; |
181 | 181 |
182 DocumentEntry::EntryKind kind() const { return kind_; } | 182 DocumentEntry::EntryKind kind() const { return kind_; } |
183 const GURL& thumbnail_url() const { return thumbnail_url_; } | 183 const GURL& thumbnail_url() const { return thumbnail_url_; } |
184 const GURL& alternate_url() const { return alternate_url_; } | 184 const GURL& alternate_url() const { return alternate_url_; } |
185 const std::string& content_mime_type() const { return content_mime_type_; } | 185 const std::string& content_mime_type() const { return content_mime_type_; } |
186 const std::string& file_md5() const { return file_md5_; } | 186 const std::string& file_md5() const { return file_md5_; } |
187 void set_file_md5(const std::string& file_md5) { file_md5_ = file_md5; } | 187 void set_file_md5(const std::string& file_md5) { file_md5_ = file_md5; } |
188 const std::string& document_extension() const { return document_extension_; } | 188 const std::string& document_extension() const { return document_extension_; } |
189 bool is_hosted_document() const { return is_hosted_document_; } | 189 bool is_hosted_document() const { return is_hosted_document_; } |
(...skipping 24 matching lines...) Expand all Loading... |
214 DISALLOW_COPY_AND_ASSIGN(GDataFile); | 214 DISALLOW_COPY_AND_ASSIGN(GDataFile); |
215 }; | 215 }; |
216 | 216 |
217 // Represents "directory" in a GData virtual file system. Maps to gdata | 217 // Represents "directory" in a GData virtual file system. Maps to gdata |
218 // collection element. | 218 // collection element. |
219 class GDataDirectory : public GDataEntry { | 219 class GDataDirectory : public GDataEntry { |
220 public: | 220 public: |
221 virtual ~GDataDirectory(); | 221 virtual ~GDataDirectory(); |
222 | 222 |
223 // Converts to/from proto. | 223 // Converts to/from proto. |
224 bool FromProto(const GDataDirectoryProto& proto) WARN_UNUSED_RESULT; | 224 void FromProto(const GDataDirectoryProto& proto); |
225 void ToProto(GDataDirectoryProto* proto) const; | 225 void ToProto(GDataDirectoryProto* proto) const; |
226 | 226 |
227 // Converts the children as a vector of GDataEntryProto. | 227 // Converts the children as a vector of GDataEntryProto. |
228 scoped_ptr<GDataEntryProtoVector> ToProtoVector() const; | 228 scoped_ptr<GDataEntryProtoVector> ToProtoVector() const; |
229 | 229 |
230 private: | 230 private: |
231 // TODO(satorux): Remove the friend statements. crbug.com/139649 | 231 // TODO(satorux): Remove the friend statements. crbug.com/139649 |
232 friend class GDataDirectoryService; | 232 friend class GDataDirectoryService; |
233 friend class GDataWapiFeedProcessor; | 233 friend class GDataWapiFeedProcessor; |
234 | 234 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // Collection of children. | 280 // Collection of children. |
281 GDataFileCollection child_files_; | 281 GDataFileCollection child_files_; |
282 GDataDirectoryCollection child_directories_; | 282 GDataDirectoryCollection child_directories_; |
283 | 283 |
284 DISALLOW_COPY_AND_ASSIGN(GDataDirectory); | 284 DISALLOW_COPY_AND_ASSIGN(GDataDirectory); |
285 }; | 285 }; |
286 | 286 |
287 } // namespace gdata | 287 } // namespace gdata |
288 | 288 |
289 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ | 289 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
OLD | NEW |