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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 return sync_service_->GetPassphraseType(); | 285 return sync_service_->GetPassphraseType(); |
286 } | 286 } |
287 | 287 |
288 jboolean ProfileSyncServiceAndroid::HasExplicitPassphraseTime( | 288 jboolean ProfileSyncServiceAndroid::HasExplicitPassphraseTime( |
289 JNIEnv* env, jobject) { | 289 JNIEnv* env, jobject) { |
290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
291 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); | 291 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); |
292 return !passphrase_time.is_null(); | 292 return !passphrase_time.is_null(); |
293 } | 293 } |
294 | 294 |
| 295 jlong ProfileSyncServiceAndroid::GetExplicitPassphraseTime( |
| 296 JNIEnv* env, jobject) { |
| 297 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 298 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); |
| 299 return passphrase_time.ToJavaTime(); |
| 300 } |
| 301 |
295 ScopedJavaLocalRef<jstring> | 302 ScopedJavaLocalRef<jstring> |
296 ProfileSyncServiceAndroid::GetSyncEnterGooglePassphraseBodyWithDateText( | 303 ProfileSyncServiceAndroid::GetSyncEnterGooglePassphraseBodyWithDateText( |
297 JNIEnv* env, jobject) { | 304 JNIEnv* env, jobject) { |
298 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
299 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); | 306 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); |
300 base::string16 passphrase_time_str = | 307 base::string16 passphrase_time_str = |
301 base::TimeFormatShortDate(passphrase_time); | 308 base::TimeFormatShortDate(passphrase_time); |
302 return base::android::ConvertUTF16ToJavaString(env, | 309 return base::android::ConvertUTF16ToJavaString(env, |
303 l10n_util::GetStringFUTF16( | 310 l10n_util::GetStringFUTF16( |
304 IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE, | 311 IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE, |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 ProfileSyncServiceAndroid* profile_sync_service_android = | 545 ProfileSyncServiceAndroid* profile_sync_service_android = |
539 new ProfileSyncServiceAndroid(env, obj); | 546 new ProfileSyncServiceAndroid(env, obj); |
540 profile_sync_service_android->Init(); | 547 profile_sync_service_android->Init(); |
541 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 548 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
542 } | 549 } |
543 | 550 |
544 // static | 551 // static |
545 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { | 552 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { |
546 return RegisterNativesImpl(env); | 553 return RegisterNativesImpl(env); |
547 } | 554 } |
OLD | NEW |