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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 | 174 |
175 void ProfileSyncServiceAndroid::SignOutSync(JNIEnv* env, jobject) { | 175 void ProfileSyncServiceAndroid::SignOutSync(JNIEnv* env, jobject) { |
176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
177 DCHECK(profile_); | 177 DCHECK(profile_); |
178 sync_service_->DisableForUser(); | 178 sync_service_->DisableForUser(); |
179 | 179 |
180 // Need to clear suppress start flag manually | 180 // Need to clear suppress start flag manually |
181 sync_prefs_->SetStartSuppressed(false); | 181 sync_prefs_->SetStartSuppressed(false); |
182 } | 182 } |
183 | 183 |
184 void ProfileSyncServiceAndroid::FlushDirectory(JNIEnv* env, jobject) { | |
185 if (sync_service_ != nullptr) { | |
nyquist
2014/09/10 17:43:09
Use NULL instead of nullptr.
Also, DCHECK for UI
maxbogue
2014/09/10 20:11:02
Added the DCHECK. I've removed the null check enti
| |
186 sync_service_->FlushDirectory(); | |
187 } | |
188 } | |
189 | |
184 ScopedJavaLocalRef<jstring> ProfileSyncServiceAndroid::QuerySyncStatusSummary( | 190 ScopedJavaLocalRef<jstring> ProfileSyncServiceAndroid::QuerySyncStatusSummary( |
185 JNIEnv* env, jobject) { | 191 JNIEnv* env, jobject) { |
186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
187 DCHECK(profile_); | 193 DCHECK(profile_); |
188 std::string status(sync_service_->QuerySyncStatusSummaryString()); | 194 std::string status(sync_service_->QuerySyncStatusSummaryString()); |
189 return ConvertUTF8ToJavaString(env, status); | 195 return ConvertUTF8ToJavaString(env, status); |
190 } | 196 } |
191 | 197 |
192 jboolean ProfileSyncServiceAndroid::SetSyncSessionsId( | 198 jboolean ProfileSyncServiceAndroid::SetSyncSessionsId( |
193 JNIEnv* env, jobject obj, jstring tag) { | 199 JNIEnv* env, jobject obj, jstring tag) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 ProfileSyncServiceAndroid* profile_sync_service_android = | 544 ProfileSyncServiceAndroid* profile_sync_service_android = |
539 new ProfileSyncServiceAndroid(env, obj); | 545 new ProfileSyncServiceAndroid(env, obj); |
540 profile_sync_service_android->Init(); | 546 profile_sync_service_android->Init(); |
541 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 547 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
542 } | 548 } |
543 | 549 |
544 // static | 550 // static |
545 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { | 551 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { |
546 return RegisterNativesImpl(env); | 552 return RegisterNativesImpl(env); |
547 } | 553 } |
OLD | NEW |