| 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/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 } | 872 } |
| 873 | 873 |
| 874 void ProfileSyncService::UpdateLastSyncedTime() { | 874 void ProfileSyncService::UpdateLastSyncedTime() { |
| 875 last_synced_time_ = base::Time::Now(); | 875 last_synced_time_ = base::Time::Now(); |
| 876 sync_prefs_.SetLastSyncedTime(last_synced_time_); | 876 sync_prefs_.SetLastSyncedTime(last_synced_time_); |
| 877 } | 877 } |
| 878 | 878 |
| 879 void ProfileSyncService::NotifyObservers() { | 879 void ProfileSyncService::NotifyObservers() { |
| 880 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_, | 880 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_, |
| 881 OnStateChanged()); | 881 OnStateChanged()); |
| 882 // TODO(akalin): Make an Observer subclass that listens and does the | |
| 883 // event routing. | |
| 884 sync_js_controller_.HandleJsEvent("onServiceStateChanged", JsEventDetails()); | |
| 885 } | 882 } |
| 886 | 883 |
| 887 void ProfileSyncService::NotifySyncCycleCompleted() { | 884 void ProfileSyncService::NotifySyncCycleCompleted() { |
| 888 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_, | 885 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_, |
| 889 OnSyncCycleCompleted()); | 886 OnSyncCycleCompleted()); |
| 890 sync_js_controller_.HandleJsEvent( | |
| 891 "onServiceStateChanged", JsEventDetails()); | |
| 892 } | 887 } |
| 893 | 888 |
| 894 void ProfileSyncService::ClearStaleErrors() { | 889 void ProfileSyncService::ClearStaleErrors() { |
| 895 ClearUnrecoverableError(); | 890 ClearUnrecoverableError(); |
| 896 last_actionable_error_ = SyncProtocolError(); | 891 last_actionable_error_ = SyncProtocolError(); |
| 897 // Clear the data type errors as well. | 892 // Clear the data type errors as well. |
| 898 failed_data_types_handler_.Reset(); | 893 failed_data_types_handler_.Reset(); |
| 899 } | 894 } |
| 900 | 895 |
| 901 void ProfileSyncService::ClearUnrecoverableError() { | 896 void ProfileSyncService::ClearUnrecoverableError() { |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2264 status.last_get_token_error = last_get_token_error_; | 2259 status.last_get_token_error = last_get_token_error_; |
| 2265 if (request_access_token_retry_timer_.IsRunning()) | 2260 if (request_access_token_retry_timer_.IsRunning()) |
| 2266 status.next_token_request_time = next_token_request_time_; | 2261 status.next_token_request_time = next_token_request_time_; |
| 2267 return status; | 2262 return status; |
| 2268 } | 2263 } |
| 2269 | 2264 |
| 2270 void ProfileSyncService::OverrideNetworkResourcesForTest( | 2265 void ProfileSyncService::OverrideNetworkResourcesForTest( |
| 2271 scoped_ptr<syncer::NetworkResources> network_resources) { | 2266 scoped_ptr<syncer::NetworkResources> network_resources) { |
| 2272 network_resources_ = network_resources.Pass(); | 2267 network_resources_ = network_resources.Pass(); |
| 2273 } | 2268 } |
| OLD | NEW |