| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 WEBKIT_BROWSER_FILEAPI_SYNCABLE_FILE_CHANGE_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SYNCABLE_FILE_CHANGE_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_SYNCABLE_FILE_CHANGE_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SYNCABLE_FILE_CHANGE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "webkit/browser/fileapi/file_system_url.h" | 13 #include "webkit/browser/fileapi/file_system_url.h" |
| 14 #include "webkit/browser/fileapi/syncable/sync_file_type.h" | 14 #include "webkit/browser/fileapi/syncable/sync_file_type.h" |
| 15 #include "webkit/storage/webkit_storage_export.h" | 15 #include "webkit/browser/webkit_storage_browser_export.h" |
| 16 | 16 |
| 17 namespace sync_file_system { | 17 namespace sync_file_system { |
| 18 | 18 |
| 19 class WEBKIT_STORAGE_EXPORT FileChange { | 19 class WEBKIT_STORAGE_BROWSER_EXPORT FileChange { |
| 20 public: | 20 public: |
| 21 enum ChangeType { | 21 enum ChangeType { |
| 22 FILE_CHANGE_ADD_OR_UPDATE, | 22 FILE_CHANGE_ADD_OR_UPDATE, |
| 23 FILE_CHANGE_DELETE, | 23 FILE_CHANGE_DELETE, |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 FileChange(ChangeType change, SyncFileType file_type); | 26 FileChange(ChangeType change, SyncFileType file_type); |
| 27 | 27 |
| 28 bool IsAddOrUpdate() const { return change_ == FILE_CHANGE_ADD_OR_UPDATE; } | 28 bool IsAddOrUpdate() const { return change_ == FILE_CHANGE_ADD_OR_UPDATE; } |
| 29 bool IsDelete() const { return change_ == FILE_CHANGE_DELETE; } | 29 bool IsDelete() const { return change_ == FILE_CHANGE_DELETE; } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 bool operator==(const FileChange& that) const { | 40 bool operator==(const FileChange& that) const { |
| 41 return change() == that.change() && | 41 return change() == that.change() && |
| 42 file_type() == that.file_type(); | 42 file_type() == that.file_type(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 ChangeType change_; | 46 ChangeType change_; |
| 47 SyncFileType file_type_; | 47 SyncFileType file_type_; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class WEBKIT_STORAGE_EXPORT FileChangeList { | 50 class WEBKIT_STORAGE_BROWSER_EXPORT FileChangeList { |
| 51 public: | 51 public: |
| 52 typedef std::deque<FileChange> List; | 52 typedef std::deque<FileChange> List; |
| 53 | 53 |
| 54 FileChangeList(); | 54 FileChangeList(); |
| 55 ~FileChangeList(); | 55 ~FileChangeList(); |
| 56 | 56 |
| 57 // Updates the list with the |new_change|. | 57 // Updates the list with the |new_change|. |
| 58 void Update(const FileChange& new_change); | 58 void Update(const FileChange& new_change); |
| 59 | 59 |
| 60 size_t size() const { return list_.size(); } | 60 size_t size() const { return list_.size(); } |
| 61 bool empty() const { return list_.empty(); } | 61 bool empty() const { return list_.empty(); } |
| 62 void clear() { list_.clear(); } | 62 void clear() { list_.clear(); } |
| 63 const List& list() const { return list_; } | 63 const List& list() const { return list_; } |
| 64 const FileChange& front() const { return list_.front(); } | 64 const FileChange& front() const { return list_.front(); } |
| 65 const FileChange& back() const { return list_.back(); } | 65 const FileChange& back() const { return list_.back(); } |
| 66 | 66 |
| 67 FileChangeList PopAndGetNewList() const; | 67 FileChangeList PopAndGetNewList() const; |
| 68 | 68 |
| 69 std::string DebugString() const; | 69 std::string DebugString() const; |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 List list_; | 72 List list_; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace sync_file_system | 75 } // namespace sync_file_system |
| 76 | 76 |
| 77 #endif // WEBKIT_BROWSER_FILEAPI_SYNCABLE_FILE_CHANGE_H_ | 77 #endif // WEBKIT_BROWSER_FILEAPI_SYNCABLE_FILE_CHANGE_H_ |
| OLD | NEW |