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> |
(...skipping 18 matching lines...) Expand all Loading... |
29 // ChangeListProcessor is used to process feeds from WAPI (codename for | 29 // ChangeListProcessor is used to process feeds from WAPI (codename for |
30 // Documents List API). | 30 // Documents List API). |
31 class ChangeListProcessor { | 31 class ChangeListProcessor { |
32 public: | 32 public: |
33 typedef std::map<std::string /* resource_id */, DriveEntryProto> | 33 typedef std::map<std::string /* resource_id */, DriveEntryProto> |
34 DriveEntryProtoMap; | 34 DriveEntryProtoMap; |
35 | 35 |
36 // Class used to record UMA stats with FeedToEntryProtoMap(). | 36 // Class used to record UMA stats with FeedToEntryProtoMap(). |
37 class ChangeListToEntryProtoMapUMAStats; | 37 class ChangeListToEntryProtoMapUMAStats; |
38 | 38 |
39 explicit ChangeListProcessor(DriveResourceMetadata* resource_metadata); | 39 explicit ChangeListProcessor(DriveResourceMetadata* resource_metadata, |
| 40 const std::string drive_root_resource_id); |
40 ~ChangeListProcessor(); | 41 ~ChangeListProcessor(); |
41 | 42 |
42 // Applies the documents feeds to the file system using |resource_metadata_|. | 43 // Applies the documents feeds to the file system using |resource_metadata_|. |
43 // | 44 // |
44 // |is_delta_feed| determines the type of feed to process, whether it is a | 45 // |is_delta_feed| determines the type of feed to process, whether it is a |
45 // root feed (false) or a delta feed (true). | 46 // root feed (false) or a delta feed (true). |
46 // | 47 // |
47 // In the case of processing the root feeds |root_feed_changestamp| is used | 48 // In the case of processing the root feeds |root_feed_changestamp| is used |
48 // as its initial changestamp value. The value comes from | 49 // as its initial changestamp value. The value comes from |
49 // google_apis::AccountMetadata. | 50 // google_apis::AccountMetadata. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 scoped_ptr<DriveEntryProto> root_proto); | 158 scoped_ptr<DriveEntryProto> root_proto); |
158 | 159 |
159 // Runs after all entries have been processed. | 160 // Runs after all entries have been processed. |
160 void OnComplete(); | 161 void OnComplete(); |
161 | 162 |
162 // Reset the state of this object. | 163 // Reset the state of this object. |
163 void Clear(); | 164 void Clear(); |
164 | 165 |
165 DriveResourceMetadata* resource_metadata_; // Not owned. | 166 DriveResourceMetadata* resource_metadata_; // Not owned. |
166 | 167 |
| 168 // Resource ID for the user's "My Drive" root. This is provided by |
| 169 // ChangeListLoader. |
| 170 const std::string drive_root_resource_id_; |
| 171 |
167 DriveEntryProtoMap entry_proto_map_; | 172 DriveEntryProtoMap entry_proto_map_; |
168 std::set<base::FilePath> changed_dirs_; | 173 std::set<base::FilePath> changed_dirs_; |
169 GURL root_upload_url_; | 174 GURL root_upload_url_; |
170 int64 largest_changestamp_; | 175 int64 largest_changestamp_; |
171 base::Closure on_complete_callback_; | 176 base::Closure on_complete_callback_; |
172 | 177 |
173 // Note: This should remain the last member so it'll be destroyed and | 178 // Note: This should remain the last member so it'll be destroyed and |
174 // invalidate its weak pointers before any other members are destroyed. | 179 // invalidate its weak pointers before any other members are destroyed. |
175 base::WeakPtrFactory<ChangeListProcessor> weak_ptr_factory_; | 180 base::WeakPtrFactory<ChangeListProcessor> weak_ptr_factory_; |
176 DISALLOW_COPY_AND_ASSIGN(ChangeListProcessor); | 181 DISALLOW_COPY_AND_ASSIGN(ChangeListProcessor); |
177 }; | 182 }; |
178 | 183 |
179 } // namespace drive | 184 } // namespace drive |
180 | 185 |
181 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ | 186 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ |
OLD | NEW |