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; |
66 import java.util.Map; | 67 import java.util.Map; |
67 import java.util.concurrent.Callable; | 68 import java.util.concurrent.Callable; |
68 | 69 |
69 /** | 70 /** |
70 * This class is the delegate to which WebViewProxy forwards all API calls. | 71 * This class is the delegate to which WebViewProxy forwards all API calls. |
71 * | 72 * |
72 * Most of the actual functionality is implemented by AwContents (or ContentView
Core within | 73 * Most of the actual functionality is implemented by AwContents (or ContentView
Core within |
73 * it). This class also contains WebView-specific APIs that require the creation
of other | 74 * it). This class also contains WebView-specific APIs that require the creation
of other |
74 * adapters (otherwise org.chromium.content would depend on the webview.chromium
package) | 75 * adapters (otherwise org.chromium.content would depend on the webview.chromium
package) |
75 * and a small set of no-op deprecated APIs. | 76 * and a small set of no-op deprecated APIs. |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 @Override | 1723 @Override |
1723 public void run() { | 1724 public void run() { |
1724 onConfigurationChanged(newConfig); | 1725 onConfigurationChanged(newConfig); |
1725 } | 1726 } |
1726 }); | 1727 }); |
1727 return; | 1728 return; |
1728 } | 1729 } |
1729 mAwContents.onConfigurationChanged(newConfig); | 1730 mAwContents.onConfigurationChanged(newConfig); |
1730 } | 1731 } |
1731 | 1732 |
1732 @Override | 1733 //TODO(hush): add override after release. |
| 1734 //@Override |
1733 public boolean onDragEvent(final DragEvent event) { | 1735 public boolean onDragEvent(final DragEvent event) { |
1734 mFactory.startYourEngines(false); | 1736 mFactory.startYourEngines(false); |
1735 if (checkNeedsPost()) { | 1737 if (checkNeedsPost()) { |
1736 boolean ret = mFactory.runOnUiThreadBlocking(new Callable<Boolean>()
{ | 1738 boolean ret = mFactory.runOnUiThreadBlocking(new Callable<Boolean>()
{ |
1737 @Override | 1739 @Override |
1738 public Boolean call() { | 1740 public Boolean call() { |
1739 return onDragEvent(event); | 1741 return onDragEvent(event); |
1740 } | 1742 } |
1741 }); | 1743 }); |
1742 return ret; | 1744 return ret; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 // Intentional no-op | 2206 // Intentional no-op |
2205 } | 2207 } |
2206 | 2208 |
2207 @Override | 2209 @Override |
2208 public int super_getScrollBarStyle() { | 2210 public int super_getScrollBarStyle() { |
2209 return mWebViewPrivate.super_getScrollBarStyle(); | 2211 return mWebViewPrivate.super_getScrollBarStyle(); |
2210 } | 2212 } |
2211 | 2213 |
2212 @Override | 2214 @Override |
2213 public void super_startActivityForResult(Intent intent, int requestCode)
{ | 2215 public void super_startActivityForResult(Intent intent, int requestCode)
{ |
2214 mWebViewPrivate.super_startActivityForResult(intent, requestCode); | 2216 // TODO(hush): Use mWebViewPrivate.super_startActivityForResult |
| 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 } |
2215 } | 2225 } |
2216 | 2226 |
2217 @Override | 2227 @Override |
2218 public boolean awakenScrollBars() { | 2228 public boolean awakenScrollBars() { |
2219 mWebViewPrivate.awakenScrollBars(0); | 2229 mWebViewPrivate.awakenScrollBars(0); |
2220 // TODO: modify the WebView.PrivateAccess to provide a return value. | 2230 // TODO: modify the WebView.PrivateAccess to provide a return value. |
2221 return true; | 2231 return true; |
2222 } | 2232 } |
2223 | 2233 |
2224 @Override | 2234 @Override |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 mAwContents.extractSmartClipData(x, y, width, height); | 2273 mAwContents.extractSmartClipData(x, y, width, height); |
2264 } | 2274 } |
2265 | 2275 |
2266 // Implements SmartClipProvider | 2276 // Implements SmartClipProvider |
2267 @Override | 2277 @Override |
2268 public void setSmartClipResultHandler(final Handler resultHandler) { | 2278 public void setSmartClipResultHandler(final Handler resultHandler) { |
2269 checkThread(); | 2279 checkThread(); |
2270 mAwContents.setSmartClipResultHandler(resultHandler); | 2280 mAwContents.setSmartClipResultHandler(resultHandler); |
2271 } | 2281 } |
2272 } | 2282 } |
OLD | NEW |