| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_android.h" | 5 #include "chrome/browser/sync/profile_sync_service_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 ObjectIdVersionMap::iterator it = | 108 ObjectIdVersionMap::iterator it = |
| 109 max_invalidation_versions_.find(object_id); | 109 max_invalidation_versions_.find(object_id); |
| 110 if ((it != max_invalidation_versions_.end()) && | 110 if ((it != max_invalidation_versions_.end()) && |
| 111 (version <= it->second)) { | 111 (version <= it->second)) { |
| 112 DVLOG(1) << "Dropping redundant invalidation with version " << version; | 112 DVLOG(1) << "Dropping redundant invalidation with version " << version; |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 max_invalidation_versions_[object_id] = version; | 115 max_invalidation_versions_[object_id] = version; |
| 116 } | 116 } |
| 117 | 117 |
| 118 syncer::ObjectIdSet object_ids; | 118 syncer::ObjectIdInvalidationMap object_ids_with_states; |
| 119 object_ids.insert(object_id); | 119 object_ids_with_states.Insert( |
| 120 syncer::ObjectIdInvalidationMap object_ids_with_states = | 120 syncer::Invalidation::Init(object_id, version, state)); |
| 121 syncer::ObjectIdSetToInvalidationMap(object_ids, version, state); | |
| 122 | 121 |
| 123 content::NotificationService::current()->Notify( | 122 content::NotificationService::current()->Notify( |
| 124 chrome::NOTIFICATION_SYNC_REFRESH_REMOTE, | 123 chrome::NOTIFICATION_SYNC_REFRESH_REMOTE, |
| 125 content::Source<Profile>(profile_), | 124 content::Source<Profile>(profile_), |
| 126 content::Details<const syncer::ObjectIdInvalidationMap>( | 125 content::Details<const syncer::ObjectIdInvalidationMap>( |
| 127 &object_ids_with_states)); | 126 &object_ids_with_states)); |
| 128 } | 127 } |
| 129 | 128 |
| 130 void ProfileSyncServiceAndroid::OnStateChanged() { | 129 void ProfileSyncServiceAndroid::OnStateChanged() { |
| 131 // Notify the java world that our sync state has changed. | 130 // Notify the java world that our sync state has changed. |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 ProfileSyncServiceAndroid* profile_sync_service_android = | 512 ProfileSyncServiceAndroid* profile_sync_service_android = |
| 514 new ProfileSyncServiceAndroid(env, obj); | 513 new ProfileSyncServiceAndroid(env, obj); |
| 515 profile_sync_service_android->Init(); | 514 profile_sync_service_android->Init(); |
| 516 return reinterpret_cast<jint>(profile_sync_service_android); | 515 return reinterpret_cast<jint>(profile_sync_service_android); |
| 517 } | 516 } |
| 518 | 517 |
| 519 // static | 518 // static |
| 520 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { | 519 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { |
| 521 return RegisterNativesImpl(env); | 520 return RegisterNativesImpl(env); |
| 522 } | 521 } |
| OLD | NEW |