Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
| 6 | 6 |
| 7 import android.content.res.Configuration; | 7 import android.content.res.Configuration; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Canvas; | 9 import android.graphics.Canvas; |
| 10 import android.graphics.Color; | 10 import android.graphics.Color; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 import org.chromium.content.browser.ContentViewCore; | 36 import org.chromium.content.browser.ContentViewCore; |
| 37 import org.chromium.content.browser.ContentViewStatics; | 37 import org.chromium.content.browser.ContentViewStatics; |
| 38 import org.chromium.content.browser.LoadUrlParams; | 38 import org.chromium.content.browser.LoadUrlParams; |
| 39 import org.chromium.content.browser.NavigationHistory; | 39 import org.chromium.content.browser.NavigationHistory; |
| 40 import org.chromium.content.browser.PageTransitionTypes; | 40 import org.chromium.content.browser.PageTransitionTypes; |
| 41 import org.chromium.content.common.CleanupReference; | 41 import org.chromium.content.common.CleanupReference; |
| 42 import org.chromium.components.navigation_interception.InterceptNavigationDelega te; | 42 import org.chromium.components.navigation_interception.InterceptNavigationDelega te; |
| 43 import org.chromium.components.navigation_interception.NavigationParams; | 43 import org.chromium.components.navigation_interception.NavigationParams; |
| 44 import org.chromium.net.GURLUtils; | 44 import org.chromium.net.GURLUtils; |
| 45 import org.chromium.ui.gfx.DeviceDisplayInfo; | 45 import org.chromium.ui.gfx.DeviceDisplayInfo; |
| 46 import org.chromium.ui.gfx.NativeWindow; | 46 import org.chromium.ui.gfx.WindowAndroid; |
| 47 | 47 |
| 48 import java.io.File; | 48 import java.io.File; |
| 49 import java.lang.annotation.Annotation; | 49 import java.lang.annotation.Annotation; |
| 50 import java.net.MalformedURLException; | 50 import java.net.MalformedURLException; |
| 51 import java.net.URL; | 51 import java.net.URL; |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Exposes the native AwContents class, and together these classes wrap the Cont entViewCore | 54 * Exposes the native AwContents class, and together these classes wrap the Cont entViewCore |
| 55 * and Browser components that are required to implement Android WebView API. Th is is the | 55 * and Browser components that are required to implement Android WebView API. Th is is the |
| 56 * primary entry point for the WebViewProvider implementation; it holds a 1:1 ob ject | 56 * primary entry point for the WebViewProvider implementation; it holds a 1:1 ob ject |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 mContentViewCore = new ContentViewCore(containerView.getContext(), | 278 mContentViewCore = new ContentViewCore(containerView.getContext(), |
| 279 ContentViewCore.PERSONALITY_VIEW); | 279 ContentViewCore.PERSONALITY_VIEW); |
| 280 mContentsClientBridge = new AwContentsClientBridge(contentsClient); | 280 mContentsClientBridge = new AwContentsClientBridge(contentsClient); |
| 281 mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate(), | 281 mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate(), |
| 282 mContentsClientBridge); | 282 mContentsClientBridge); |
| 283 mContentsClient = contentsClient; | 283 mContentsClient = contentsClient; |
| 284 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNati veAwContents)); | 284 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNati veAwContents)); |
| 285 | 285 |
| 286 int nativeWebContents = nativeGetWebContents(mNativeAwContents); | 286 int nativeWebContents = nativeGetWebContents(mNativeAwContents); |
| 287 mContentViewCore.initialize(containerView, internalAccessAdapter, | 287 mContentViewCore.initialize(containerView, internalAccessAdapter, |
| 288 nativeWebContents, | 288 nativeWebContents, new AwWindowAndroid(mContainerView.getContext ()), false, |
|
joth
2013/04/18 01:41:17
could you add a bug link here about the fact the A
aurimas (slooooooooow)
2013/04/18 02:49:57
Done.
| |
| 289 new AwNativeWindow(mContainerView.getContext()), | |
| 290 isAccessFromFileURLsGrantedByDefault); | 289 isAccessFromFileURLsGrantedByDefault); |
| 291 mContentViewCore.setContentViewClient(mContentsClient); | 290 mContentViewCore.setContentViewClient(mContentsClient); |
| 292 mLayoutSizer = new AwLayoutSizer(new AwLayoutSizerDelegate()); | 291 mLayoutSizer = new AwLayoutSizer(new AwLayoutSizerDelegate()); |
| 293 mContentViewCore.setContentSizeChangeListener(new AwContentStateChangeLi stener()); | 292 mContentViewCore.setContentSizeChangeListener(new AwContentStateChangeLi stener()); |
| 294 mContentsClient.installWebContentsObserver(mContentViewCore); | 293 mContentsClient.installWebContentsObserver(mContentViewCore); |
| 295 | 294 |
| 296 mSettings = new AwSettings(mContentViewCore.getContext(), nativeWebConte nts); | 295 mSettings = new AwSettings(mContentViewCore.getContext(), nativeWebConte nts); |
| 297 setIoThreadClient(new IoThreadClientImpl()); | 296 setIoThreadClient(new IoThreadClientImpl()); |
| 298 setInterceptNavigationDelegate(new InterceptNavigationDelegateImpl()); | 297 setInterceptNavigationDelegate(new InterceptNavigationDelegateImpl()); |
| 299 | 298 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 | 523 |
| 525 private void setNewWebContents(int newWebContentsPtr) { | 524 private void setNewWebContents(int newWebContentsPtr) { |
| 526 // When setting a new WebContents, we new up a ContentViewCore that will | 525 // When setting a new WebContents, we new up a ContentViewCore that will |
| 527 // wrap it and then swap it. | 526 // wrap it and then swap it. |
| 528 ContentViewCore newCore = new ContentViewCore(mContainerView.getContext( ), | 527 ContentViewCore newCore = new ContentViewCore(mContainerView.getContext( ), |
| 529 ContentViewCore.PERSONALITY_VIEW); | 528 ContentViewCore.PERSONALITY_VIEW); |
| 530 // Note we pass false for isAccessFromFileURLsGrantedByDefault as we'll | 529 // Note we pass false for isAccessFromFileURLsGrantedByDefault as we'll |
| 531 // set it correctly when when we copy the settings from the old ContentV iewCore | 530 // set it correctly when when we copy the settings from the old ContentV iewCore |
| 532 // into the new one. | 531 // into the new one. |
| 533 newCore.initialize(mContainerView, mInternalAccessAdapter, | 532 newCore.initialize(mContainerView, mInternalAccessAdapter, |
| 534 newWebContentsPtr, new AwNativeWindow(mContainerView.getContext( )), | 533 newWebContentsPtr, new AwWindowAndroid(mContainerView.getContext ()), |
| 535 false); | 534 false, false); |
| 536 newCore.setContentViewClient(mContentsClient); | 535 newCore.setContentViewClient(mContentsClient); |
| 537 mContentsClient.installWebContentsObserver(newCore); | 536 mContentsClient.installWebContentsObserver(newCore); |
| 538 | 537 |
| 539 ContentSettings oldSettings = mContentViewCore.getContentSettings(); | 538 ContentSettings oldSettings = mContentViewCore.getContentSettings(); |
| 540 newCore.getContentSettings().initFrom(oldSettings); | 539 newCore.getContentSettings().initFrom(oldSettings); |
| 541 | 540 |
| 542 // Now swap the Java side reference. | 541 // Now swap the Java side reference. |
| 543 mContentViewCore.destroy(); | 542 mContentViewCore.destroy(); |
| 544 mContentViewCore = newCore; | 543 mContentViewCore = newCore; |
| 545 | 544 |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1356 private native boolean nativeDrawSW(int nativeAwContents, Canvas canvas, int clipX, int clipY, | 1355 private native boolean nativeDrawSW(int nativeAwContents, Canvas canvas, int clipX, int clipY, |
| 1357 int clipW, int clipH); | 1356 int clipW, int clipH); |
| 1358 private native int nativeGetAwDrawGLViewContext(int nativeAwContents); | 1357 private native int nativeGetAwDrawGLViewContext(int nativeAwContents); |
| 1359 private native Picture nativeCapturePicture(int nativeAwContents); | 1358 private native Picture nativeCapturePicture(int nativeAwContents); |
| 1360 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled, | 1359 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled, |
| 1361 boolean invalidationOnly); | 1360 boolean invalidationOnly); |
| 1362 | 1361 |
| 1363 private native void nativeInvokeGeolocationCallback( | 1362 private native void nativeInvokeGeolocationCallback( |
| 1364 int nativeAwContents, boolean value, String requestingFrame); | 1363 int nativeAwContents, boolean value, String requestingFrame); |
| 1365 } | 1364 } |
| OLD | NEW |