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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 465 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
466 | 466 |
467 scoped_ptr<DictionaryValue> about_info = | 467 scoped_ptr<DictionaryValue> about_info = |
468 sync_ui_util::ConstructAboutInformation(sync_service_); | 468 sync_ui_util::ConstructAboutInformation(sync_service_); |
469 std::string about_info_json; | 469 std::string about_info_json; |
470 base::JSONWriter::Write(about_info.get(), &about_info_json); | 470 base::JSONWriter::Write(about_info.get(), &about_info_json); |
471 | 471 |
472 return ConvertUTF8ToJavaString(env, about_info_json); | 472 return ConvertUTF8ToJavaString(env, about_info_json); |
473 } | 473 } |
474 | 474 |
| 475 jlong ProfileSyncServiceAndroid::GetLastSyncedTimeForTest( |
| 476 JNIEnv* env, jobject obj) { |
| 477 return static_cast<jlong>( |
| 478 profile_->GetPrefs()->GetInt64(prefs::kSyncLastSyncedTime)); |
| 479 } |
| 480 |
475 void ProfileSyncServiceAndroid::NudgeSyncer(JNIEnv* env, | 481 void ProfileSyncServiceAndroid::NudgeSyncer(JNIEnv* env, |
476 jobject obj, | 482 jobject obj, |
477 jstring objectId, | 483 jstring objectId, |
478 jlong version, | 484 jlong version, |
479 jstring state) { | 485 jstring state) { |
480 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 486 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
481 SendNudgeNotification(ConvertJavaStringToUTF8(env, objectId), version, | 487 SendNudgeNotification(ConvertJavaStringToUTF8(env, objectId), version, |
482 ConvertJavaStringToUTF8(env, state)); | 488 ConvertJavaStringToUTF8(env, state)); |
483 } | 489 } |
484 | 490 |
(...skipping 20 matching lines...) Expand all Loading... |
505 ProfileSyncServiceAndroid* profile_sync_service_android = | 511 ProfileSyncServiceAndroid* profile_sync_service_android = |
506 new ProfileSyncServiceAndroid(env, obj); | 512 new ProfileSyncServiceAndroid(env, obj); |
507 profile_sync_service_android->Init(); | 513 profile_sync_service_android->Init(); |
508 return reinterpret_cast<jint>(profile_sync_service_android); | 514 return reinterpret_cast<jint>(profile_sync_service_android); |
509 } | 515 } |
510 | 516 |
511 // static | 517 // static |
512 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { | 518 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { |
513 return RegisterNativesImpl(env); | 519 return RegisterNativesImpl(env); |
514 } | 520 } |
OLD | NEW |