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

Unified Diff: android_webview/native/aw_contents.h

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/native/aw_contents.h
diff --git a/android_webview/native/aw_contents.h b/android_webview/native/aw_contents.h
index e441bd12e245a3fb04ade1b12908c2c483decf6e..0f53f48fb3cf6347cbb22bbdf710b38288b5a673 100644
--- a/android_webview/native/aw_contents.h
+++ b/android_webview/native/aw_contents.h
@@ -8,6 +8,7 @@
#include <jni.h>
#include <string>
+#include "android_webview/browser/find_helper.h"
#include "base/android/scoped_java_ref.h"
#include "base/android/jni_helper.h"
#include "base/memory/scoped_ptr.h"
@@ -28,7 +29,7 @@ class AwWebContentsDelegate;
// Provides the ownership of and access to browser components required for
// WebView functionality; analogous to chrome's TabContents, but with a
// level of indirection provided by the AwContentsContainer abstraction.
-class AwContents {
+class AwContents : public FindHelper::Listener {
public:
// Returns the AwContents instance associated with |web_contents|, or NULL.
static AwContents* FromWebContents(content::WebContents* web_contents);
@@ -37,7 +38,7 @@ class AwContents {
jobject obj,
jobject web_contents_delegate,
bool private_browsing);
- ~AwContents();
+ virtual ~AwContents();
// |handler| is an instance of
// org.chromium.android_webview.AwHttpAuthHandler.
@@ -52,11 +53,24 @@ class AwContents {
void GenerateMHTML(JNIEnv* env, jobject obj, jstring jpath, jobject callback);
void SetIoThreadClient(JNIEnv* env, jobject obj, jobject client);
+ // Find-in-page API and related methods.
+ jint FindAllSync(JNIEnv* env, jobject obj, jstring search_string);
+ void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string);
+ void FindNext(JNIEnv* env, jobject obj, jboolean forward);
+ void ClearMatches(JNIEnv* env, jobject obj);
+
+ FindHelper* GetFindHelper();
+
+ // FindHelper::Listener implementation.
+ virtual void OnFindResultReceived(int active_ordinal,
+ int match_count,
+ bool finished) OVERRIDE;
private:
JavaObjectWeakGlobalRef java_ref_;
scoped_ptr<AwContentsContainer> contents_container_;
scoped_ptr<AwWebContentsDelegate> web_contents_delegate_;
scoped_ptr<AwRenderViewHostExt> render_view_host_ext_;
+ scoped_ptr<FindHelper> find_helper_;
DISALLOW_COPY_AND_ASSIGN(AwContents);
};

Powered by Google App Engine
This is Rietveld 408576698