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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.content.ComponentCallbacks2; | 9 import android.content.ComponentCallbacks2; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 } | 853 } |
854 onSizeChanged(mContainerView.getWidth(), mContainerView.getHeight(), 0,
0); | 854 onSizeChanged(mContainerView.getWidth(), mContainerView.getHeight(), 0,
0); |
855 if (wasWindowVisible) setWindowVisibilityInternal(true); | 855 if (wasWindowVisible) setWindowVisibilityInternal(true); |
856 if (wasViewVisible) setViewVisibilityInternal(true); | 856 if (wasViewVisible) setViewVisibilityInternal(true); |
857 if (wasWindowFocused) onWindowFocusChanged(wasWindowFocused); | 857 if (wasWindowFocused) onWindowFocusChanged(wasWindowFocused); |
858 if (wasFocused) onFocusChanged(true, 0, null); | 858 if (wasFocused) onFocusChanged(true, 0, null); |
859 | 859 |
860 // Restore injected JavaScript interfaces. | 860 // Restore injected JavaScript interfaces. |
861 for (Map.Entry<String, Pair<Object, Class>> entry : javascriptInterfaces
.entrySet()) { | 861 for (Map.Entry<String, Pair<Object, Class>> entry : javascriptInterfaces
.entrySet()) { |
862 @SuppressWarnings("unchecked") | 862 @SuppressWarnings("unchecked") |
863 Class<? extends Annotation> requiredAnnotation = (Class<? extends An
notation>) | 863 Class<? extends Annotation> requiredAnnotation = entry.getValue().se
cond; |
864 entry.getValue().second; | |
865 mContentViewCore.addPossiblyUnsafeJavascriptInterface( | 864 mContentViewCore.addPossiblyUnsafeJavascriptInterface( |
866 entry.getValue().first, | 865 entry.getValue().first, |
867 entry.getKey(), | 866 entry.getKey(), |
868 requiredAnnotation); | 867 requiredAnnotation); |
869 } | 868 } |
870 } | 869 } |
871 | 870 |
872 /** | 871 /** |
873 * Destroys this object and deletes its native counterpart. | 872 * Destroys this object and deletes its native counterpart. |
874 */ | 873 */ |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 return mPageScaleFactor; | 1618 return mPageScaleFactor; |
1620 } | 1619 } |
1621 | 1620 |
1622 /** | 1621 /** |
1623 * @see android.webkit.WebView#getScale() | 1622 * @see android.webkit.WebView#getScale() |
1624 * | 1623 * |
1625 * Please note that the scale returned is the page scale multiplied by | 1624 * Please note that the scale returned is the page scale multiplied by |
1626 * the screen density factor. See CTS WebViewTest.testSetInitialScale. | 1625 * the screen density factor. See CTS WebViewTest.testSetInitialScale. |
1627 */ | 1626 */ |
1628 public float getScale() { | 1627 public float getScale() { |
1629 return (float)(mPageScaleFactor * mDIPScale); | 1628 return (float) (mPageScaleFactor * mDIPScale); |
1630 } | 1629 } |
1631 | 1630 |
1632 /** | 1631 /** |
1633 * @see android.webkit.WebView#flingScroll(int, int) | 1632 * @see android.webkit.WebView#flingScroll(int, int) |
1634 */ | 1633 */ |
1635 public void flingScroll(int velocityX, int velocityY) { | 1634 public void flingScroll(int velocityX, int velocityY) { |
1636 mScrollOffsetManager.flingScroll(velocityX, velocityY); | 1635 mScrollOffsetManager.flingScroll(velocityX, velocityY); |
1637 } | 1636 } |
1638 | 1637 |
1639 /** | 1638 /** |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 mMinPageScaleFactor == minPageScaleFactor && | 2166 mMinPageScaleFactor == minPageScaleFactor && |
2168 mMaxPageScaleFactor == maxPageScaleFactor) { | 2167 mMaxPageScaleFactor == maxPageScaleFactor) { |
2169 return; | 2168 return; |
2170 } | 2169 } |
2171 mMinPageScaleFactor = minPageScaleFactor; | 2170 mMinPageScaleFactor = minPageScaleFactor; |
2172 mMaxPageScaleFactor = maxPageScaleFactor; | 2171 mMaxPageScaleFactor = maxPageScaleFactor; |
2173 if (mPageScaleFactor != pageScaleFactor) { | 2172 if (mPageScaleFactor != pageScaleFactor) { |
2174 float oldPageScaleFactor = mPageScaleFactor; | 2173 float oldPageScaleFactor = mPageScaleFactor; |
2175 mPageScaleFactor = pageScaleFactor; | 2174 mPageScaleFactor = pageScaleFactor; |
2176 mContentsClient.getCallbackHelper().postOnScaleChangedScaled( | 2175 mContentsClient.getCallbackHelper().postOnScaleChangedScaled( |
2177 (float)(oldPageScaleFactor * mDIPScale), | 2176 (float) (oldPageScaleFactor * mDIPScale), |
2178 (float)(mPageScaleFactor * mDIPScale)); | 2177 (float) (mPageScaleFactor * mDIPScale)); |
2179 } | 2178 } |
2180 } | 2179 } |
2181 | 2180 |
2182 private void saveWebArchiveInternal(String path, final ValueCallback<String>
callback) { | 2181 private void saveWebArchiveInternal(String path, final ValueCallback<String>
callback) { |
2183 if (path == null || isDestroyed()) { | 2182 if (path == null || isDestroyed()) { |
2184 ThreadUtils.runOnUiThread(new Runnable() { | 2183 ThreadUtils.runOnUiThread(new Runnable() { |
2185 @Override | 2184 @Override |
2186 public void run() { | 2185 public void run() { |
2187 callback.onReceiveValue(null); | 2186 callback.onReceiveValue(null); |
2188 } | 2187 } |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 | 2546 |
2548 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean
networkUp); | 2547 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean
networkUp); |
2549 | 2548 |
2550 private native void nativeTrimMemory(long nativeAwContents, int level, boole
an visible); | 2549 private native void nativeTrimMemory(long nativeAwContents, int level, boole
an visible); |
2551 | 2550 |
2552 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo
rter awPdfExporter); | 2551 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo
rter awPdfExporter); |
2553 | 2552 |
2554 private native void nativePreauthorizePermission(long nativeAwContents, Stri
ng origin, | 2553 private native void nativePreauthorizePermission(long nativeAwContents, Stri
ng origin, |
2555 long resources); | 2554 long resources); |
2556 } | 2555 } |
OLD | NEW |