[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:
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user