Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 10941015: [Android] Upstream the WebView find-in-page API implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fixes + command line switch for synchronous APIs Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index ba8b4f131adc7c4e581eaf45f47924edb749d93c..22341c2e45cb8d91e89e09dc659f45052f39ff29 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -102,8 +102,24 @@ public class AwContents {
mCleanupReference.cleanupNow();
}
+ public int findAllSync(String searchString) {
+ return nativeFindAllSync(mNativeAwContents, searchString);
+ }
+
+ public void findAllAsync(String searchString) {
+ nativeFindAllAsync(mNativeAwContents, searchString);
+ }
+
+ public void findNext(boolean forward) {
+ nativeFindNext(mNativeAwContents, forward);
+ }
+
+ public void clearMatches() {
+ nativeClearMatches(mNativeAwContents);
+ }
+
/**
- * @return load progress of the WebContents
+ * @return load progress of the WebContents.
*/
public int getMostRecentProgress() {
// WebContentsDelegateAndroid conveniently caches the most recent notified value for us.
@@ -171,6 +187,12 @@ public class AwContents {
mContentsClient.onReceivedHttpAuthRequest(handler, host, realm);
}
+ @CalledByNative
+ public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches,
+ boolean isDoneCounting) {
+ mContentsClient.onFindResultReceived(activeMatchOrdinal, numberOfMatches, isDoneCounting);
+ }
+
// -------------------------------------------------------------------------------------------
// Helper methods
// -------------------------------------------------------------------------------------------
@@ -238,4 +260,9 @@ public class AwContents {
private native void nativeSetIoThreadClient(int nativeAwContents,
AwContentsIoThreadClient ioThreadClient);
+
+ private native int nativeFindAllSync(int nativeAwContents, String searchString);
+ private native void nativeFindAllAsync(int nativeAwContents, String searchString);
+ private native void nativeFindNext(int nativeAwContents, boolean forward);
+ private native void nativeClearMatches(int nativeAwContents);
}

Powered by Google App Engine
This is Rietveld 408576698