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

Commit

Permalink
Add GetExplicitPassphraseTime() JNI call.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
maxbogue authored and Commit bot committed Oct 9, 2014
1 parent 289d16f commit c021ddc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,14 @@ public boolean hasExplicitPassphraseTime() {
return nativeHasExplicitPassphraseTime(mNativeProfileSyncServiceAndroid);
}

/**
* Returns the current explicit passphrase time in milliseconds since epoch.
*/
public long getExplicitPassphraseTime() {
assert isSyncInitialized();
return nativeGetExplicitPassphraseTime(mNativeProfileSyncServiceAndroid);
}

public String getSyncEnterGooglePassphraseBodyWithDateText() {
assert isSyncInitialized();
return nativeGetSyncEnterGooglePassphraseBodyWithDateText(mNativeProfileSyncServiceAndroid);
Expand Down Expand Up @@ -585,6 +593,7 @@ private native void nativeSetEncryptionPassphrase(
private native boolean nativeIsCryptographerReady(long nativeProfileSyncServiceAndroid);
private native int nativeGetPassphraseType(long nativeProfileSyncServiceAndroid);
private native boolean nativeHasExplicitPassphraseTime(long nativeProfileSyncServiceAndroid);
private native long nativeGetExplicitPassphraseTime(long nativeProfileSyncServiceAndroid);
private native String nativeGetSyncEnterGooglePassphraseBodyWithDateText(
long nativeProfileSyncServiceAndroid);
private native String nativeGetSyncEnterCustomPassphraseBodyWithDateText(
Expand Down
7 changes: 7 additions & 0 deletions chrome/browser/sync/profile_sync_service_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,13 @@ jboolean ProfileSyncServiceAndroid::HasExplicitPassphraseTime(
return !passphrase_time.is_null();
}

jlong ProfileSyncServiceAndroid::GetExplicitPassphraseTime(
JNIEnv* env, jobject) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime();
return passphrase_time.ToJavaTime();
}

ScopedJavaLocalRef<jstring>
ProfileSyncServiceAndroid::GetSyncEnterGooglePassphraseBodyWithDateText(
JNIEnv* env, jobject) {
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/sync/profile_sync_service_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver {
// Returns true if the current explicit passphrase time is defined.
jboolean HasExplicitPassphraseTime(JNIEnv* env, jobject);

// Returns the current explicit passphrase time.
jlong GetExplicitPassphraseTime(JNIEnv* env, jobject);

base::android::ScopedJavaLocalRef<jstring>
GetSyncEnterGooglePassphraseBodyWithDateText(
JNIEnv* env, jobject);
Expand Down

0 comments on commit c021ddc

Please sign in to comment.