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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 return sync_service_->GetPassphraseType(); | 250 return sync_service_->GetPassphraseType(); |
251 } | 251 } |
252 | 252 |
253 jboolean ProfileSyncServiceAndroid::HasExplicitPassphraseTime( | 253 jboolean ProfileSyncServiceAndroid::HasExplicitPassphraseTime( |
254 JNIEnv* env, jobject) { | 254 JNIEnv* env, jobject) { |
255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
256 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); | 256 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); |
257 return !passphrase_time.is_null(); | 257 return !passphrase_time.is_null(); |
258 } | 258 } |
259 | 259 |
| 260 jlong ProfileSyncServiceAndroid::GetExplicitPassphraseTime( |
| 261 JNIEnv* env, jobject) { |
| 262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 263 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); |
| 264 return passphrase_time.ToJavaTime(); |
| 265 } |
| 266 |
260 ScopedJavaLocalRef<jstring> | 267 ScopedJavaLocalRef<jstring> |
261 ProfileSyncServiceAndroid::GetSyncEnterGooglePassphraseBodyWithDateText( | 268 ProfileSyncServiceAndroid::GetSyncEnterGooglePassphraseBodyWithDateText( |
262 JNIEnv* env, jobject) { | 269 JNIEnv* env, jobject) { |
263 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
264 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); | 271 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); |
265 base::string16 passphrase_time_str = | 272 base::string16 passphrase_time_str = |
266 base::TimeFormatShortDate(passphrase_time); | 273 base::TimeFormatShortDate(passphrase_time); |
267 return base::android::ConvertUTF16ToJavaString(env, | 274 return base::android::ConvertUTF16ToJavaString(env, |
268 l10n_util::GetStringFUTF16( | 275 l10n_util::GetStringFUTF16( |
269 IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE, | 276 IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 ProfileSyncServiceAndroid* profile_sync_service_android = | 488 ProfileSyncServiceAndroid* profile_sync_service_android = |
482 new ProfileSyncServiceAndroid(env, obj); | 489 new ProfileSyncServiceAndroid(env, obj); |
483 profile_sync_service_android->Init(); | 490 profile_sync_service_android->Init(); |
484 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 491 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
485 } | 492 } |
486 | 493 |
487 // static | 494 // static |
488 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { | 495 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { |
489 return RegisterNativesImpl(env); | 496 return RegisterNativesImpl(env); |
490 } | 497 } |
OLD | NEW |