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/drive_sync_client.h" | 5 #include "chrome/browser/chromeos/drive/drive_sync_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 DVLOG(1) << "Uploaded " << resource_id; | 423 DVLOG(1) << "Uploaded " << resource_id; |
424 } else { | 424 } else { |
425 // TODO(satorux): We should re-queue if the error is recoverable. | 425 // TODO(satorux): We should re-queue if the error is recoverable. |
426 LOG(WARNING) << "Failed to upload " << resource_id << ": " << error; | 426 LOG(WARNING) << "Failed to upload " << resource_id << ": " << error; |
427 } | 427 } |
428 | 428 |
429 // Continue the loop. | 429 // Continue the loop. |
430 DoSyncLoop(); | 430 DoSyncLoop(); |
431 } | 431 } |
432 | 432 |
433 void DriveSyncClient::Observe(int type, | 433 void DriveSyncClient::OnPreferenceChanged(PrefServiceBase* service, |
434 const content::NotificationSource& source, | 434 const std::string& pref_name) { |
435 const content::NotificationDetails& details) { | |
436 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 435 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
437 | 436 |
438 // Resume the sync loop if gdata preferences are changed. Note that we | 437 // Resume the sync loop if gdata preferences are changed. Note that we |
439 // don't need to check the new values here as these will be checked in | 438 // don't need to check the new values here as these will be checked in |
440 // ShouldStopSyncLoop() as soon as the loop is resumed. | 439 // ShouldStopSyncLoop() as soon as the loop is resumed. |
441 StartSyncLoop(); | 440 StartSyncLoop(); |
442 } | 441 } |
443 | 442 |
444 void DriveSyncClient::OnConnectionTypeChanged( | 443 void DriveSyncClient::OnConnectionTypeChanged( |
445 net::NetworkChangeNotifier::ConnectionType type) { | 444 net::NetworkChangeNotifier::ConnectionType type) { |
446 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 445 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
447 | 446 |
448 // Resume the sync loop if the network is changed. Note that we don't need to | 447 // Resume the sync loop if the network is changed. Note that we don't need to |
449 // check the type of the network as it will be checked in ShouldStopSyncLoop() | 448 // check the type of the network as it will be checked in ShouldStopSyncLoop() |
450 // as soon as the loop is resumed. | 449 // as soon as the loop is resumed. |
451 StartSyncLoop(); | 450 StartSyncLoop(); |
452 } | 451 } |
453 | 452 |
454 } // namespace drive | 453 } // namespace drive |
OLD | NEW |