Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / drive / file_change.h
blob0285bd983000cc50df1499ac2b8a99de5b5e3f33
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CHANGE_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CHANGE_H_
8 #include <set>
10 #include "base/files/file_path.h"
12 namespace drive {
14 class FileChange;
16 // Set of changes.
17 typedef std::set<FileChange> FileChangeSet;
19 // Represents change in the filesystem. Rename is represented as two entries:
20 // of type DELETED and ADDED. CHANGED type is for changed contents of
21 // directories or for changed metadata and/or contents of files.
22 class FileChange {
23 public:
24 enum Type {
25 DELETED,
26 ADDED,
27 CHANGED,
30 // Created an object representing a change of file or directory pointed by
31 // |change_path|. The change is of |change_type| type.
32 FileChange(const base::FilePath& path, Type type);
33 ~FileChange();
35 // Factory method to create a FileChangeSet object with only one element.
36 static FileChangeSet CreateSingleSet(const base::FilePath& path, Type type);
38 bool operator==(const FileChange &file_change) const {
39 return path_ == file_change.path() && type_ == file_change.type();
42 bool operator<(const FileChange &file_change) const {
43 return (path_ < file_change.path()) ||
44 (path_ == file_change.path() && type_ < file_change.type());
47 const base::FilePath& path() const { return path_; }
49 Type type() const { return type_; }
51 private:
52 const base::FilePath path_;
53 const Type type_;
56 } // namespace drive
58 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CHANGE_H_