Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit c021ddc

Browse files
maxbogueCommit bot
maxbogue
authored and
Commit bot
committed
Add GetExplicitPassphraseTime() JNI call.
This change is in preparation for a bug fix in Chrome for Android. BUG=419927 Review URL: https://codereview.chromium.org/630223003 Cr-Commit-Position: refs/heads/master@{#298896}
1 parent 289d16f commit c021ddc

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,14 @@ public boolean hasExplicitPassphraseTime() {
236236
return nativeHasExplicitPassphraseTime(mNativeProfileSyncServiceAndroid);
237237
}
238238

239+
/**
240+
* Returns the current explicit passphrase time in milliseconds since epoch.
241+
*/
242+
public long getExplicitPassphraseTime() {
243+
assert isSyncInitialized();
244+
return nativeGetExplicitPassphraseTime(mNativeProfileSyncServiceAndroid);
245+
}
246+
239247
public String getSyncEnterGooglePassphraseBodyWithDateText() {
240248
assert isSyncInitialized();
241249
return nativeGetSyncEnterGooglePassphraseBodyWithDateText(mNativeProfileSyncServiceAndroid);
@@ -585,6 +593,7 @@ private native void nativeSetEncryptionPassphrase(
585593
private native boolean nativeIsCryptographerReady(long nativeProfileSyncServiceAndroid);
586594
private native int nativeGetPassphraseType(long nativeProfileSyncServiceAndroid);
587595
private native boolean nativeHasExplicitPassphraseTime(long nativeProfileSyncServiceAndroid);
596+
private native long nativeGetExplicitPassphraseTime(long nativeProfileSyncServiceAndroid);
588597
private native String nativeGetSyncEnterGooglePassphraseBodyWithDateText(
589598
long nativeProfileSyncServiceAndroid);
590599
private native String nativeGetSyncEnterCustomPassphraseBodyWithDateText(

chrome/browser/sync/profile_sync_service_android.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ jboolean ProfileSyncServiceAndroid::HasExplicitPassphraseTime(
257257
return !passphrase_time.is_null();
258258
}
259259

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+
260267
ScopedJavaLocalRef<jstring>
261268
ProfileSyncServiceAndroid::GetSyncEnterGooglePassphraseBodyWithDateText(
262269
JNIEnv* env, jobject) {

chrome/browser/sync/profile_sync_service_android.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver {
112112
// Returns true if the current explicit passphrase time is defined.
113113
jboolean HasExplicitPassphraseTime(JNIEnv* env, jobject);
114114

115+
// Returns the current explicit passphrase time.
116+
jlong GetExplicitPassphraseTime(JNIEnv* env, jobject);
117+
115118
base::android::ScopedJavaLocalRef<jstring>
116119
GetSyncEnterGooglePassphraseBodyWithDateText(
117120
JNIEnv* env, jobject);

0 commit comments

Comments
 (0)