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