| 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 return sync_service_->HasUnrecoverableError(); | 434 return sync_service_->HasUnrecoverableError(); |
| 435 } | 435 } |
| 436 | 436 |
| 437 ScopedJavaLocalRef<jstring> ProfileSyncServiceAndroid::GetAboutInfoForTest( | 437 ScopedJavaLocalRef<jstring> ProfileSyncServiceAndroid::GetAboutInfoForTest( |
| 438 JNIEnv* env, jobject) { | 438 JNIEnv* env, jobject) { |
| 439 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 439 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 440 | 440 |
| 441 scoped_ptr<base::DictionaryValue> about_info = | 441 scoped_ptr<base::DictionaryValue> about_info = |
| 442 sync_ui_util::ConstructAboutInformation(sync_service_); | 442 sync_ui_util::ConstructAboutInformation(sync_service_); |
| 443 std::string about_info_json; | 443 std::string about_info_json; |
| 444 base::JSONWriter::Write(about_info.get(), &about_info_json); | 444 base::JSONWriter::Write(*about_info, &about_info_json); |
| 445 | 445 |
| 446 return ConvertUTF8ToJavaString(env, about_info_json); | 446 return ConvertUTF8ToJavaString(env, about_info_json); |
| 447 } | 447 } |
| 448 | 448 |
| 449 jlong ProfileSyncServiceAndroid::GetLastSyncedTimeForTest( | 449 jlong ProfileSyncServiceAndroid::GetLastSyncedTimeForTest( |
| 450 JNIEnv* env, jobject obj) { | 450 JNIEnv* env, jobject obj) { |
| 451 // Use profile preferences here instead of SyncPrefs to avoid an extra | 451 // Use profile preferences here instead of SyncPrefs to avoid an extra |
| 452 // conversion, since SyncPrefs::GetLastSyncedTime() converts the stored value | 452 // conversion, since SyncPrefs::GetLastSyncedTime() converts the stored value |
| 453 // to to base::Time. | 453 // to to base::Time. |
| 454 return static_cast<jlong>( | 454 return static_cast<jlong>( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 ProfileSyncServiceAndroid* profile_sync_service_android = | 541 ProfileSyncServiceAndroid* profile_sync_service_android = |
| 542 new ProfileSyncServiceAndroid(env, obj); | 542 new ProfileSyncServiceAndroid(env, obj); |
| 543 profile_sync_service_android->Init(); | 543 profile_sync_service_android->Init(); |
| 544 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 544 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
| 545 } | 545 } |
| 546 | 546 |
| 547 // static | 547 // static |
| 548 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { | 548 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { |
| 549 return RegisterNativesImpl(env); | 549 return RegisterNativesImpl(env); |
| 550 } | 550 } |
| OLD | NEW |