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/gdata/gdata_sync_client.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" |
6 | 6 |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
350 | 350 |
351 if (!success) { | 351 if (!success) { |
352 LOG(WARNING) << "Cache entry not found: " << resource_id; | 352 LOG(WARNING) << "Cache entry not found: " << resource_id; |
353 return; | 353 return; |
354 } | 354 } |
355 | 355 |
356 // If MD5s don't match, it indicates the local cache file is stale, unless | 356 // If MD5s don't match, it indicates the local cache file is stale, unless |
357 // the file is dirty (the MD5 is "local"). We should never re-fetch the | 357 // the file is dirty (the MD5 is "local"). We should never re-fetch the |
358 // file when we have a locally modified version. | 358 // file when we have a locally modified version. |
359 if (latest_md5 != cache_entry.md5 && !cache_entry.IsDirty()) { | 359 if (latest_md5 != cache_entry.md5() && !cache_entry.IsDirty()) { |
360 cache_->RemoveOnUIThread( | 360 cache_->RemoveOnUIThread( |
361 resource_id, | 361 resource_id, |
362 base::Bind(&GDataSyncClient::OnRemove, | 362 base::Bind(&GDataSyncClient::OnRemove, |
363 weak_ptr_factory_.GetWeakPtr())); | 363 weak_ptr_factory_.GetWeakPtr())); |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 void GDataSyncClient::OnRemove(base::PlatformFileError error, | 367 void GDataSyncClient::OnRemove(base::PlatformFileError error, |
368 const std::string& resource_id, | 368 const std::string& resource_id, |
369 const std::string& md5) { | 369 const std::string& md5) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 const content::NotificationDetails& details) { | 447 const content::NotificationDetails& details) { |
448 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 448 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
449 | 449 |
450 // Resume the sync loop if gdata preferences are changed. Note that we | 450 // Resume the sync loop if gdata preferences are changed. Note that we |
451 // don't need to check the new values here as these will be checked in | 451 // don't need to check the new values here as these will be checked in |
452 // ShouldStopSyncLoop() as soon as the loop is resumed. | 452 // ShouldStopSyncLoop() as soon as the loop is resumed. |
453 StartSyncLoop(); | 453 StartSyncLoop(); |
454 } | 454 } |
455 | 455 |
456 } // namespace gdata | 456 } // namespace gdata |
OLD | NEW |