| 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/sync_file_system/sync_file_system_service.h" | 5 #include "chrome/browser/sync_file_system/sync_file_system_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 promoting_demoted_changes_ = false; | 389 promoting_demoted_changes_ = false; |
| 390 CheckIfIdle(); | 390 CheckIfIdle(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void SyncFileSystemService::CheckIfIdle() { | 393 void SyncFileSystemService::CheckIfIdle() { |
| 394 if (promoting_demoted_changes_) | 394 if (promoting_demoted_changes_) |
| 395 return; | 395 return; |
| 396 | 396 |
| 397 for (size_t i = 0; i < remote_sync_runners_.size(); ++i) { | 397 for (size_t i = 0; i < remote_sync_runners_.size(); ++i) { |
| 398 SyncServiceState service_state = remote_sync_runners_[i]->GetServiceState(); | 398 SyncServiceState service_state = remote_sync_runners_[i]->GetServiceState(); |
| 399 if (service_state != SYNC_SERVICE_RUNNING && | 399 if (service_state != SYNC_SERVICE_RUNNING) |
| 400 service_state != SYNC_SERVICE_TEMPORARY_UNAVAILABLE) | |
| 401 continue; | 400 continue; |
| 402 | 401 |
| 403 if (remote_sync_runners_[i]->pending_changes()) | 402 if (remote_sync_runners_[i]->pending_changes()) |
| 404 return; | 403 return; |
| 405 } | 404 } |
| 406 | 405 |
| 407 for (size_t i = 0; i < local_sync_runners_.size(); ++i) { | 406 for (size_t i = 0; i < local_sync_runners_.size(); ++i) { |
| 408 SyncServiceState service_state = local_sync_runners_[i]->GetServiceState(); | 407 SyncServiceState service_state = local_sync_runners_[i]->GetServiceState(); |
| 409 if (service_state != SYNC_SERVICE_RUNNING && | 408 if (service_state != SYNC_SERVICE_RUNNING) |
| 410 service_state != SYNC_SERVICE_TEMPORARY_UNAVAILABLE) | |
| 411 continue; | 409 continue; |
| 412 | 410 |
| 413 if (local_sync_runners_[i]->pending_changes()) | 411 if (local_sync_runners_[i]->pending_changes()) |
| 414 return; | 412 return; |
| 415 } | 413 } |
| 416 | 414 |
| 417 if (idle_callback_.is_null()) | 415 if (idle_callback_.is_null()) |
| 418 return; | 416 return; |
| 419 | 417 |
| 420 base::Closure callback = idle_callback_; | 418 base::Closure callback = idle_callback_; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 iter != remote_sync_runners_.end(); ++iter) | 745 iter != remote_sync_runners_.end(); ++iter) |
| 748 ((*iter)->*method)(); | 746 ((*iter)->*method)(); |
| 749 } | 747 } |
| 750 | 748 |
| 751 RemoteFileSyncService* SyncFileSystemService::GetRemoteService( | 749 RemoteFileSyncService* SyncFileSystemService::GetRemoteService( |
| 752 const GURL& origin) { | 750 const GURL& origin) { |
| 753 return remote_service_.get(); | 751 return remote_service_.get(); |
| 754 } | 752 } |
| 755 | 753 |
| 756 } // namespace sync_file_system | 754 } // namespace sync_file_system |
| OLD | NEW |