| 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 "sync/internal_api/public/sync_manager.h" | 5 #include "sync/internal_api/public/sync_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 | 819 |
| 820 void SyncManager::RequestCleanupDisabledTypes( | 820 void SyncManager::RequestCleanupDisabledTypes( |
| 821 const browser_sync::ModelSafeRoutingInfo& routing_info) { | 821 const browser_sync::ModelSafeRoutingInfo& routing_info) { |
| 822 DCHECK(thread_checker_.CalledOnValidThread()); | 822 DCHECK(thread_checker_.CalledOnValidThread()); |
| 823 if (data_->scheduler()) { | 823 if (data_->scheduler()) { |
| 824 data_->session_context()->set_routing_info(routing_info); | 824 data_->session_context()->set_routing_info(routing_info); |
| 825 data_->scheduler()->CleanupDisabledTypes(); | 825 data_->scheduler()->CleanupDisabledTypes(); |
| 826 } | 826 } |
| 827 } | 827 } |
| 828 | 828 |
| 829 void SyncManager::RequestClearServerData() { | |
| 830 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 831 if (data_->scheduler()) | |
| 832 data_->scheduler()->ClearUserData(); | |
| 833 } | |
| 834 | |
| 835 void SyncManager::RequestConfig( | 829 void SyncManager::RequestConfig( |
| 836 const browser_sync::ModelSafeRoutingInfo& routing_info, | 830 const browser_sync::ModelSafeRoutingInfo& routing_info, |
| 837 const ModelTypeSet& types, ConfigureReason reason) { | 831 const ModelTypeSet& types, ConfigureReason reason) { |
| 838 DCHECK(thread_checker_.CalledOnValidThread()); | 832 DCHECK(thread_checker_.CalledOnValidThread()); |
| 839 if (!data_->scheduler()) { | 833 if (!data_->scheduler()) { |
| 840 LOG(INFO) | 834 LOG(INFO) |
| 841 << "SyncManager::RequestConfig: bailing out because scheduler is " | 835 << "SyncManager::RequestConfig: bailing out because scheduler is " |
| 842 << "null"; | 836 << "null"; |
| 843 return; | 837 return; |
| 844 } | 838 } |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2049 } | 2043 } |
| 2050 } | 2044 } |
| 2051 } | 2045 } |
| 2052 | 2046 |
| 2053 if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) { | 2047 if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) { |
| 2054 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 2048 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 2055 OnStopSyncingPermanently()); | 2049 OnStopSyncingPermanently()); |
| 2056 return; | 2050 return; |
| 2057 } | 2051 } |
| 2058 | 2052 |
| 2059 if (event.what_happened == SyncEngineEvent::CLEAR_SERVER_DATA_SUCCEEDED) { | |
| 2060 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | |
| 2061 OnClearServerDataSucceeded()); | |
| 2062 return; | |
| 2063 } | |
| 2064 | |
| 2065 if (event.what_happened == SyncEngineEvent::CLEAR_SERVER_DATA_FAILED) { | |
| 2066 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | |
| 2067 OnClearServerDataFailed()); | |
| 2068 return; | |
| 2069 } | |
| 2070 | |
| 2071 if (event.what_happened == SyncEngineEvent::UPDATED_TOKEN) { | 2053 if (event.what_happened == SyncEngineEvent::UPDATED_TOKEN) { |
| 2072 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 2054 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 2073 OnUpdatedToken(event.updated_token)); | 2055 OnUpdatedToken(event.updated_token)); |
| 2074 return; | 2056 return; |
| 2075 } | 2057 } |
| 2076 | 2058 |
| 2077 if (event.what_happened == SyncEngineEvent::ACTIONABLE_ERROR) { | 2059 if (event.what_happened == SyncEngineEvent::ACTIONABLE_ERROR) { |
| 2078 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 2060 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 2079 OnActionableError( | 2061 OnActionableError( |
| 2080 event.snapshot.errors().sync_protocol_error)); | 2062 event.snapshot.errors().sync_protocol_error)); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2503 share->directory->GetDownloadProgress(i.Get(), &marker); | 2485 share->directory->GetDownloadProgress(i.Get(), &marker); |
| 2504 | 2486 |
| 2505 if (marker.token().empty()) | 2487 if (marker.token().empty()) |
| 2506 result.Put(i.Get()); | 2488 result.Put(i.Get()); |
| 2507 | 2489 |
| 2508 } | 2490 } |
| 2509 return result; | 2491 return result; |
| 2510 } | 2492 } |
| 2511 | 2493 |
| 2512 } // namespace sync_api | 2494 } // namespace sync_api |
| OLD | NEW |