Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_files.h

Issue 10854199: ResourceId and unit test cleanup. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: minor Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/platform_file.h" 16 #include "base/platform_file.h"
16 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" 17 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h"
17 18
18 namespace gdata { 19 namespace gdata {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 base::PlatformFileInfo* file_info); 57 base::PlatformFileInfo* file_info);
57 58
58 // Converts the platform file info to the proto representation. 59 // Converts the platform file info to the proto representation.
59 static void ConvertPlatformFileInfoToProto( 60 static void ConvertPlatformFileInfoToProto(
60 const base::PlatformFileInfo& file_info, 61 const base::PlatformFileInfo& file_info,
61 PlatformFileInfoProto* proto); 62 PlatformFileInfoProto* proto);
62 63
63 // 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
64 // touch |file_specific_info|). 65 // touch |file_specific_info|).
65 bool FromProto(const GDataEntryProto& proto) WARN_UNUSED_RESULT; 66 bool FromProto(const GDataEntryProto& proto) WARN_UNUSED_RESULT;
67 // TODO(achuith,satorux): Should this be virtual?
66 void ToProto(GDataEntryProto* proto) const; 68 void ToProto(GDataEntryProto* proto) const;
67 69
68 // Similar to ToProto() but this fills in |file_specific_info| and 70 // Similar to ToProto() but this fills in |file_specific_info| and
69 // |directory_specific_info| based on the actual type of the entry. 71 // |directory_specific_info| based on the actual type of the entry.
70 // 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
71 // GDataEntryProto. 73 // GDataEntryProto.
72 void ToProtoFull(GDataEntryProto* proto) const; 74 void ToProtoFull(GDataEntryProto* proto) const;
73 75
74 // Escapes forward slashes from file names with magic unicode character 76 // Escapes forward slashes from file names with magic unicode character
75 // \u2215 pretty much looks the same in UI. 77 // \u2215 pretty much looks the same in UI.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 162
161 GDataDirectory* parent_; 163 GDataDirectory* parent_;
162 // Weak pointer to GDataDirectoryService. 164 // Weak pointer to GDataDirectoryService.
163 GDataDirectoryService* directory_service_; 165 GDataDirectoryService* directory_service_;
164 bool deleted_; 166 bool deleted_;
165 167
166 private: 168 private:
167 DISALLOW_COPY_AND_ASSIGN(GDataEntry); 169 DISALLOW_COPY_AND_ASSIGN(GDataEntry);
168 }; 170 };
169 171
170 typedef std::map<FilePath::StringType, GDataFile*> GDataFileCollection;
171 typedef std::map<FilePath::StringType, GDataDirectory*>
172 GDataDirectoryCollection;
173
174 // 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,
175 // 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.
176 class GDataFile : public GDataEntry { 174 class GDataFile : public GDataEntry {
177 public: 175 public:
178 virtual ~GDataFile(); 176 virtual ~GDataFile();
179 177
180 // Converts to/from proto. 178 // Converts to/from proto.
181 bool FromProto(const GDataEntryProto& proto) WARN_UNUSED_RESULT; 179 bool FromProto(const GDataEntryProto& proto) WARN_UNUSED_RESULT;
182 void ToProto(GDataEntryProto* proto) const; 180 void ToProto(GDataEntryProto* proto) const;
183 181
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 public: 220 public:
223 virtual ~GDataDirectory(); 221 virtual ~GDataDirectory();
224 222
225 // Converts to/from proto. 223 // Converts to/from proto.
226 bool FromProto(const GDataDirectoryProto& proto) WARN_UNUSED_RESULT; 224 bool FromProto(const GDataDirectoryProto& proto) WARN_UNUSED_RESULT;
227 void ToProto(GDataDirectoryProto* proto) const; 225 void ToProto(GDataDirectoryProto* proto) const;
228 226
229 // Converts the children as a vector of GDataEntryProto. 227 // Converts the children as a vector of GDataEntryProto.
230 scoped_ptr<GDataEntryProtoVector> ToProtoVector() const; 228 scoped_ptr<GDataEntryProtoVector> ToProtoVector() const;
231 229
232 // Collection of children files/directories.
233 const GDataFileCollection& child_files() const { return child_files_; }
234 const GDataDirectoryCollection& child_directories() const {
235 return child_directories_;
236 }
satorux1 2012/08/17 11:49:17 glad to see them gone.
237
238 private: 230 private:
239 // TODO(satorux): Remove the friend statements. crbug.com/139649 231 // TODO(satorux): Remove the friend statements. crbug.com/139649
240 friend class GDataDirectoryService; 232 friend class GDataDirectoryService;
241 friend class GDataWapiFeedProcessor; 233 friend class GDataWapiFeedProcessor;
242 234
243 explicit GDataDirectory(GDataDirectoryService* directory_service); 235 explicit GDataDirectory(GDataDirectoryService* directory_service);
244 236
245 // Initializes from DocumentEntry. 237 // Initializes from DocumentEntry.
246 virtual void InitFromDocumentEntry(const DocumentEntry& doc) OVERRIDE; 238 virtual void InitFromDocumentEntry(const DocumentEntry& doc) OVERRIDE;
247 239
(...skipping 23 matching lines...) Expand all
271 263
272 // Removes the entry from its children without destroying the 264 // Removes the entry from its children without destroying the
273 // entry instance. 265 // entry instance.
274 void RemoveChild(GDataEntry* entry); 266 void RemoveChild(GDataEntry* entry);
275 267
276 // Removes child elements. 268 // Removes child elements.
277 void RemoveChildren(); 269 void RemoveChildren();
278 void RemoveChildFiles(); 270 void RemoveChildFiles();
279 void RemoveChildDirectories(); 271 void RemoveChildDirectories();
280 272
281 // Collection of children GDataEntry items. 273 // Recursively extracts the paths set of all sub-directories.
274 void GetChildDirectoryPaths(std::set<FilePath>* child_dirs);
275
276 // Maps between base_name and resource_id of files and directories.
277 typedef std::map<FilePath::StringType, GDataFile*> GDataFileCollection;
278 typedef std::map<FilePath::StringType, GDataDirectory*>
279 GDataDirectoryCollection;
280 // Collection of children.
282 GDataFileCollection child_files_; 281 GDataFileCollection child_files_;
283 GDataDirectoryCollection child_directories_; 282 GDataDirectoryCollection child_directories_;
284 283
285 DISALLOW_COPY_AND_ASSIGN(GDataDirectory); 284 DISALLOW_COPY_AND_ASSIGN(GDataDirectory);
286 }; 285 };
287 286
288 } // namespace gdata 287 } // namespace gdata
289 288
290 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ 289 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698