0

[Android] Install a WebContentsObserverAndroid in android_webview.

To proxy WebContentsObserverAndroid calls to the embedder, we need
to create an instance of the observer.

Android trybots are green and only touches java, so no need for CQ to look at other bots.
NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/10969071

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158306 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
benm@chromium.org
2012-09-24 17:31:55 +00:00
parent 3bf09e842d
commit 55eece222c
2 changed files with 10 additions and 2 deletions
android_webview/java/src/org/chromium/android_webview

@ -82,6 +82,7 @@ public class AwContents {
nativeGetWebContents(mNativeAwContents), nativeWindow,
isAccessFromFileURLsGrantedByDefault);
mContentViewCore.setContentViewClient(contentsClient);
mContentsClient.installWebContentsObserver(mContentViewCore);
}
public ContentViewCore getContentViewCore() {

@ -30,6 +30,8 @@ public abstract class AwContentsClient extends ContentViewClient {
private final WebContentsDelegateAdapter mWebContentsDelegateAdapter =
new WebContentsDelegateAdapter();
private AwWebContentsObserver mWebContentsObserver;
//--------------------------------------------------------------------------------------------
// Adapter for WebContentsDelegate methods.
//--------------------------------------------------------------------------------------------
@ -104,8 +106,8 @@ public abstract class AwContentsClient extends ContentViewClient {
}
}
class WebContentsObserverAdapter extends WebContentsObserverAndroid {
public WebContentsObserverAdapter(ContentViewCore contentViewCore) {
class AwWebContentsObserver extends WebContentsObserverAndroid {
public AwWebContentsObserver(ContentViewCore contentViewCore) {
super(contentViewCore);
}
@ -127,6 +129,11 @@ public abstract class AwContentsClient extends ContentViewClient {
}
}
void installWebContentsObserver(ContentViewCore contentViewCore) {
assert mWebContentsObserver == null;
mWebContentsObserver = new AwWebContentsObserver(contentViewCore);
}
final AwWebContentsDelegate getWebContentsDelegate() {
return mWebContentsDelegateAdapter;
}