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