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_DRIVE_CHANGE_LIST_PROCESSOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "chrome/browser/chromeos/drive/file_errors.h" | 15 #include "chrome/browser/chromeos/drive/file_errors.h" |
| 16 #include "chrome/browser/chromeos/drive/file_errors.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 namespace google_apis { | 19 namespace google_apis { |
19 class AboutResource; | 20 class AboutResource; |
20 class ChangeList; | 21 class ChangeList; |
21 class FileList; | 22 class FileList; |
22 } // google_apis | 23 } // google_apis |
23 | 24 |
24 namespace drive { | 25 namespace drive { |
25 | 26 |
| 27 class FileChange; |
26 class ResourceEntry; | 28 class ResourceEntry; |
27 | 29 |
28 namespace internal { | 30 namespace internal { |
29 | 31 |
30 class ResourceMetadata; | 32 class ResourceMetadata; |
31 | 33 |
32 // Holds information needed to fetch contents of a directory. | 34 // Holds information needed to fetch contents of a directory. |
33 // This object is copyable. | 35 // This object is copyable. |
34 class DirectoryFetchInfo { | 36 class DirectoryFetchInfo { |
35 public: | 37 public: |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Applies change lists or full resource lists to |resource_metadata_|. | 109 // Applies change lists or full resource lists to |resource_metadata_|. |
108 // | 110 // |
109 // |is_delta_update| determines the type of input data to process, whether | 111 // |is_delta_update| determines the type of input data to process, whether |
110 // it is full resource lists (false) or change lists (true). | 112 // it is full resource lists (false) or change lists (true). |
111 // | 113 // |
112 // Must be run on the same task runner as |resource_metadata_| uses. | 114 // Must be run on the same task runner as |resource_metadata_| uses. |
113 FileError Apply(scoped_ptr<google_apis::AboutResource> about_resource, | 115 FileError Apply(scoped_ptr<google_apis::AboutResource> about_resource, |
114 ScopedVector<ChangeList> change_lists, | 116 ScopedVector<ChangeList> change_lists, |
115 bool is_delta_update); | 117 bool is_delta_update); |
116 | 118 |
117 // The set of changed directories as a result of change list processing. | 119 // The set of changed files as a result of change list processing. |
118 const std::set<base::FilePath>& changed_dirs() const { return changed_dirs_; } | 120 const FileChange& changed_files() const { return *changed_files_; } |
119 | 121 |
120 // Adds or refreshes the child entries from |change_list| to the directory. | 122 // Adds or refreshes the child entries from |change_list| to the directory. |
121 static FileError RefreshDirectory( | 123 static FileError RefreshDirectory( |
122 ResourceMetadata* resource_metadata, | 124 ResourceMetadata* resource_metadata, |
123 const DirectoryFetchInfo& directory_fetch_info, | 125 const DirectoryFetchInfo& directory_fetch_info, |
124 scoped_ptr<ChangeList> change_list, | 126 scoped_ptr<ChangeList> change_list, |
125 std::vector<ResourceEntry>* out_refreshed_entries); | 127 std::vector<ResourceEntry>* out_refreshed_entries); |
126 | 128 |
127 // Sets |entry|'s parent_local_id. | 129 // Sets |entry|'s parent_local_id. |
128 static FileError SetParentLocalIdOfEntry( | 130 static FileError SetParentLocalIdOfEntry( |
(...skipping 16 matching lines...) Expand all Loading... |
145 // Apply |entry| to resource_metadata_. | 147 // Apply |entry| to resource_metadata_. |
146 FileError ApplyEntry(const ResourceEntry& entry); | 148 FileError ApplyEntry(const ResourceEntry& entry); |
147 | 149 |
148 // Adds the directories changed by the update on |entry| to |changed_dirs_|. | 150 // Adds the directories changed by the update on |entry| to |changed_dirs_|. |
149 void UpdateChangedDirs(const ResourceEntry& entry); | 151 void UpdateChangedDirs(const ResourceEntry& entry); |
150 | 152 |
151 ResourceMetadata* resource_metadata_; // Not owned. | 153 ResourceMetadata* resource_metadata_; // Not owned. |
152 | 154 |
153 ResourceEntryMap entry_map_; | 155 ResourceEntryMap entry_map_; |
154 ParentResourceIdMap parent_resource_id_map_; | 156 ParentResourceIdMap parent_resource_id_map_; |
155 std::set<base::FilePath> changed_dirs_; | 157 scoped_ptr<FileChange> changed_files_; |
156 | 158 |
157 DISALLOW_COPY_AND_ASSIGN(ChangeListProcessor); | 159 DISALLOW_COPY_AND_ASSIGN(ChangeListProcessor); |
158 }; | 160 }; |
159 | 161 |
160 } // namespace internal | 162 } // namespace internal |
161 } // namespace drive | 163 } // namespace drive |
162 | 164 |
163 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ | 165 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ |
OLD | NEW |