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 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 5 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 OnChangeListLoadComplete(callback, DRIVE_FILE_ERROR_FAILED); | 212 OnChangeListLoadComplete(callback, DRIVE_FILE_ERROR_FAILED); |
213 return; | 213 return; |
214 } | 214 } |
215 | 215 |
216 if (directory_fetch_info.empty()) { | 216 if (directory_fetch_info.empty()) { |
217 // If the caller is not interested in a particular directory, just start | 217 // If the caller is not interested in a particular directory, just start |
218 // loading the change list. | 218 // loading the change list. |
219 LoadChangeListFromServer(about_resource.Pass(), | 219 LoadChangeListFromServer(about_resource.Pass(), |
220 start_changestamp, | 220 start_changestamp, |
221 callback); | 221 callback); |
222 } else if (directory_fetch_info.changestamp() < remote_changestamp) { | 222 } else if (directory_fetch_info.changestamp() < remote_changestamp && |
| 223 !util::IsSpecialResourceId(directory_fetch_info.resource_id())) { |
223 // If the caller is interested in a particular directory, and the | 224 // If the caller is interested in a particular directory, and the |
224 // directory changestamp is older than server's, start loading the | 225 // directory changestamp is older than server's, start loading the |
225 // directory first. | 226 // directory first. Skip special entries as they are not meaningful in the |
| 227 // server. |
226 DVLOG(1) << "Fast-fetching directory: " << directory_fetch_info.ToString() | 228 DVLOG(1) << "Fast-fetching directory: " << directory_fetch_info.ToString() |
227 << "; remote_changestamp: " << remote_changestamp; | 229 << "; remote_changestamp: " << remote_changestamp; |
228 const DirectoryFetchInfo new_directory_fetch_info( | 230 const DirectoryFetchInfo new_directory_fetch_info( |
229 directory_fetch_info.resource_id(), remote_changestamp); | 231 directory_fetch_info.resource_id(), remote_changestamp); |
230 DoLoadDirectoryFromServer( | 232 DoLoadDirectoryFromServer( |
231 new_directory_fetch_info, | 233 new_directory_fetch_info, |
232 base::Bind(&ChangeListLoader::StartLoadChangeListFromServer, | 234 base::Bind(&ChangeListLoader::StartLoadChangeListFromServer, |
233 weak_ptr_factory_.GetWeakPtr(), | 235 weak_ptr_factory_.GetWeakPtr(), |
234 directory_fetch_info, | 236 directory_fetch_info, |
235 base::Passed(&about_resource), | 237 base::Passed(&about_resource), |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 for (size_t i = 0; i < callbacks.size(); ++i) { | 858 for (size_t i = 0; i < callbacks.size(); ++i) { |
857 base::MessageLoopProxy::current()->PostTask( | 859 base::MessageLoopProxy::current()->PostTask( |
858 FROM_HERE, | 860 FROM_HERE, |
859 base::Bind(callbacks[i], error)); | 861 base::Bind(callbacks[i], error)); |
860 } | 862 } |
861 pending_load_callback_.erase(it); | 863 pending_load_callback_.erase(it); |
862 } | 864 } |
863 } | 865 } |
864 | 866 |
865 } // namespace drive | 867 } // namespace drive |
OLD | NEW |