Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: chrome/browser/sync/profile_sync_service.cc

Issue 162283002: Move towards event-driven JS on about:sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + fix some issues (reupload) Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } 874 }
875 875
876 void ProfileSyncService::UpdateLastSyncedTime() { 876 void ProfileSyncService::UpdateLastSyncedTime() {
877 last_synced_time_ = base::Time::Now(); 877 last_synced_time_ = base::Time::Now();
878 sync_prefs_.SetLastSyncedTime(last_synced_time_); 878 sync_prefs_.SetLastSyncedTime(last_synced_time_);
879 } 879 }
880 880
881 void ProfileSyncService::NotifyObservers() { 881 void ProfileSyncService::NotifyObservers() {
882 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_, 882 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_,
883 OnStateChanged()); 883 OnStateChanged());
884 // TODO(akalin): Make an Observer subclass that listens and does the
885 // event routing.
886 sync_js_controller_.HandleJsEvent("onServiceStateChanged", JsEventDetails());
887 } 884 }
888 885
889 void ProfileSyncService::NotifySyncCycleCompleted() { 886 void ProfileSyncService::NotifySyncCycleCompleted() {
890 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_, 887 FOR_EACH_OBSERVER(ProfileSyncServiceBase::Observer, observers_,
891 OnSyncCycleCompleted()); 888 OnSyncCycleCompleted());
892 sync_js_controller_.HandleJsEvent(
893 "onServiceStateChanged", JsEventDetails());
894 } 889 }
895 890
896 void ProfileSyncService::ClearStaleErrors() { 891 void ProfileSyncService::ClearStaleErrors() {
897 ClearUnrecoverableError(); 892 ClearUnrecoverableError();
898 last_actionable_error_ = SyncProtocolError(); 893 last_actionable_error_ = SyncProtocolError();
899 // Clear the data type errors as well. 894 // Clear the data type errors as well.
900 failed_data_types_handler_.Reset(); 895 failed_data_types_handler_.Reset();
901 } 896 }
902 897
903 void ProfileSyncService::ClearUnrecoverableError() { 898 void ProfileSyncService::ClearUnrecoverableError() {
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 status.last_get_token_error = last_get_token_error_; 2241 status.last_get_token_error = last_get_token_error_;
2247 if (request_access_token_retry_timer_.IsRunning()) 2242 if (request_access_token_retry_timer_.IsRunning())
2248 status.next_token_request_time = next_token_request_time_; 2243 status.next_token_request_time = next_token_request_time_;
2249 return status; 2244 return status;
2250 } 2245 }
2251 2246
2252 void ProfileSyncService::OverrideNetworkResourcesForTest( 2247 void ProfileSyncService::OverrideNetworkResourcesForTest(
2253 scoped_ptr<syncer::NetworkResources> network_resources) { 2248 scoped_ptr<syncer::NetworkResources> network_resources) {
2254 network_resources_ = network_resources.Pass(); 2249 network_resources_ = network_resources.Pass();
2255 } 2250 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698