OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 com.android.webview.chromium; | 5 package com.android.webview.chromium; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 import org.chromium.android_webview.AwSettings; | 56 import org.chromium.android_webview.AwSettings; |
57 import org.chromium.android_webview.ResourcesContextWrapperFactory; | 57 import org.chromium.android_webview.ResourcesContextWrapperFactory; |
58 import org.chromium.base.ThreadUtils; | 58 import org.chromium.base.ThreadUtils; |
59 import org.chromium.base.annotations.SuppressFBWarnings; | 59 import org.chromium.base.annotations.SuppressFBWarnings; |
60 import org.chromium.content.browser.SmartClipProvider; | 60 import org.chromium.content.browser.SmartClipProvider; |
61 import org.chromium.content_public.browser.NavigationHistory; | 61 import org.chromium.content_public.browser.NavigationHistory; |
62 | 62 |
63 import java.io.BufferedWriter; | 63 import java.io.BufferedWriter; |
64 import java.io.File; | 64 import java.io.File; |
65 import java.lang.reflect.Field; | 65 import java.lang.reflect.Field; |
66 import java.lang.reflect.Method; | |
67 import java.util.Map; | 66 import java.util.Map; |
68 import java.util.concurrent.Callable; | 67 import java.util.concurrent.Callable; |
69 | 68 |
70 /** | 69 /** |
71 * This class is the delegate to which WebViewProxy forwards all API calls. | 70 * This class is the delegate to which WebViewProxy forwards all API calls. |
72 * | 71 * |
73 * Most of the actual functionality is implemented by AwContents (or ContentView Core within | 72 * Most of the actual functionality is implemented by AwContents (or ContentView Core within |
74 * it). This class also contains WebView-specific APIs that require the creation of other | 73 * it). This class also contains WebView-specific APIs that require the creation of other |
75 * adapters (otherwise org.chromium.content would depend on the webview.chromium package) | 74 * adapters (otherwise org.chromium.content would depend on the webview.chromium package) |
76 * and a small set of no-op deprecated APIs. | 75 * and a small set of no-op deprecated APIs. |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1723 @Override | 1722 @Override |
1724 public void run() { | 1723 public void run() { |
1725 onConfigurationChanged(newConfig); | 1724 onConfigurationChanged(newConfig); |
1726 } | 1725 } |
1727 }); | 1726 }); |
1728 return; | 1727 return; |
1729 } | 1728 } |
1730 mAwContents.onConfigurationChanged(newConfig); | 1729 mAwContents.onConfigurationChanged(newConfig); |
1731 } | 1730 } |
1732 | 1731 |
1733 //TODO(hush): add override after release. | 1732 @Override |
1734 //@Override | |
1735 public boolean onDragEvent(final DragEvent event) { | 1733 public boolean onDragEvent(final DragEvent event) { |
1736 mFactory.startYourEngines(false); | 1734 mFactory.startYourEngines(false); |
1737 if (checkNeedsPost()) { | 1735 if (checkNeedsPost()) { |
1738 boolean ret = mFactory.runOnUiThreadBlocking(new Callable<Boolean>() { | 1736 boolean ret = mFactory.runOnUiThreadBlocking(new Callable<Boolean>() { |
1739 @Override | 1737 @Override |
1740 public Boolean call() { | 1738 public Boolean call() { |
1741 return onDragEvent(event); | 1739 return onDragEvent(event); |
1742 } | 1740 } |
1743 }); | 1741 }); |
1744 return ret; | 1742 return ret; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2206 // Intentional no-op | 2204 // Intentional no-op |
2207 } | 2205 } |
2208 | 2206 |
2209 @Override | 2207 @Override |
2210 public int super_getScrollBarStyle() { | 2208 public int super_getScrollBarStyle() { |
2211 return mWebViewPrivate.super_getScrollBarStyle(); | 2209 return mWebViewPrivate.super_getScrollBarStyle(); |
2212 } | 2210 } |
2213 | 2211 |
2214 @Override | 2212 @Override |
2215 public void super_startActivityForResult(Intent intent, int requestCode) { | 2213 public void super_startActivityForResult(Intent intent, int requestCode) { |
2216 // TODO(hush): Use mWebViewPrivate.super_startActivityForResult | 2214 mWebViewPrivate.super_startActivityForResult(intent, requestCode); |
Torne
2017/03/10 15:53:42
This change caused crbug.com/699972 - this functio
boliu
2017/03/10 16:54:47
Huh, odd. How did this not throw an exception befo
| |
2217 // after N release. crbug.com/543272. | |
2218 try { | |
2219 Method startActivityForResultMethod = | |
2220 View.class.getMethod("startActivityForResult", Intent.cl ass, int.class); | |
2221 startActivityForResultMethod.invoke(mWebView, intent, requestCod e); | |
2222 } catch (Exception e) { | |
2223 throw new RuntimeException("Invalid reflection", e); | |
2224 } | |
2225 } | 2215 } |
2226 | 2216 |
2227 @Override | 2217 @Override |
2228 public boolean awakenScrollBars() { | 2218 public boolean awakenScrollBars() { |
2229 mWebViewPrivate.awakenScrollBars(0); | 2219 mWebViewPrivate.awakenScrollBars(0); |
2230 // TODO: modify the WebView.PrivateAccess to provide a return value. | 2220 // TODO: modify the WebView.PrivateAccess to provide a return value. |
2231 return true; | 2221 return true; |
2232 } | 2222 } |
2233 | 2223 |
2234 @Override | 2224 @Override |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2273 mAwContents.extractSmartClipData(x, y, width, height); | 2263 mAwContents.extractSmartClipData(x, y, width, height); |
2274 } | 2264 } |
2275 | 2265 |
2276 // Implements SmartClipProvider | 2266 // Implements SmartClipProvider |
2277 @Override | 2267 @Override |
2278 public void setSmartClipResultHandler(final Handler resultHandler) { | 2268 public void setSmartClipResultHandler(final Handler resultHandler) { |
2279 checkThread(); | 2269 checkThread(); |
2280 mAwContents.setSmartClipResultHandler(resultHandler); | 2270 mAwContents.setSmartClipResultHandler(resultHandler); |
2281 } | 2271 } |
2282 } | 2272 } |
OLD | NEW |