Chromium Code Reviews| 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.app.assist.AssistStructure.ViewNode; | 9 import android.app.assist.AssistStructure.ViewNode; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| 11 import android.content.Intent; | |
| 11 import android.content.res.Configuration; | 12 import android.content.res.Configuration; |
| 12 import android.graphics.Bitmap; | 13 import android.graphics.Bitmap; |
| 13 import android.graphics.Canvas; | 14 import android.graphics.Canvas; |
| 14 import android.graphics.Paint; | 15 import android.graphics.Paint; |
| 15 import android.graphics.Picture; | 16 import android.graphics.Picture; |
| 16 import android.graphics.Rect; | 17 import android.graphics.Rect; |
| 17 import android.graphics.drawable.Drawable; | 18 import android.graphics.drawable.Drawable; |
| 18 import android.net.Uri; | 19 import android.net.Uri; |
| 19 import android.net.http.SslCertificate; | 20 import android.net.http.SslCertificate; |
| 20 import android.os.Build; | 21 import android.os.Build; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 import org.chromium.android_webview.AwSettings; | 56 import org.chromium.android_webview.AwSettings; |
| 56 import org.chromium.base.ThreadUtils; | 57 import org.chromium.base.ThreadUtils; |
| 57 import org.chromium.base.annotations.SuppressFBWarnings; | 58 import org.chromium.base.annotations.SuppressFBWarnings; |
| 58 import org.chromium.content.browser.SmartClipProvider; | 59 import org.chromium.content.browser.SmartClipProvider; |
| 59 import org.chromium.content_public.browser.AccessibilitySnapshotCallback; | 60 import org.chromium.content_public.browser.AccessibilitySnapshotCallback; |
| 60 import org.chromium.content_public.browser.AccessibilitySnapshotNode; | 61 import org.chromium.content_public.browser.AccessibilitySnapshotNode; |
| 61 import org.chromium.content_public.browser.NavigationHistory; | 62 import org.chromium.content_public.browser.NavigationHistory; |
| 62 | 63 |
| 63 import java.io.BufferedWriter; | 64 import java.io.BufferedWriter; |
| 64 import java.io.File; | 65 import java.io.File; |
| 66 import java.lang.reflect.Method; | |
| 65 import java.util.Iterator; | 67 import java.util.Iterator; |
| 66 import java.util.Map; | 68 import java.util.Map; |
| 67 import java.util.Queue; | 69 import java.util.Queue; |
| 68 import java.util.concurrent.Callable; | 70 import java.util.concurrent.Callable; |
| 69 import java.util.concurrent.ConcurrentLinkedQueue; | 71 import java.util.concurrent.ConcurrentLinkedQueue; |
| 70 import java.util.concurrent.FutureTask; | 72 import java.util.concurrent.FutureTask; |
| 71 import java.util.concurrent.TimeUnit; | 73 import java.util.concurrent.TimeUnit; |
| 72 | 74 |
| 73 /** | 75 /** |
| 74 * This class is the delegate to which WebViewProxy forwards all API calls. | 76 * This class is the delegate to which WebViewProxy forwards all API calls. |
| (...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1743 @Override | 1745 @Override |
| 1744 public void run() { | 1746 public void run() { |
| 1745 mAwContents.setLayoutParams(layoutParams); | 1747 mAwContents.setLayoutParams(layoutParams); |
| 1746 } | 1748 } |
| 1747 }); | 1749 }); |
| 1748 return; | 1750 return; |
| 1749 } | 1751 } |
| 1750 mAwContents.setLayoutParams(layoutParams); | 1752 mAwContents.setLayoutParams(layoutParams); |
| 1751 } | 1753 } |
| 1752 | 1754 |
| 1755 // Overrides WebViewProvider.ViewDelegate.onActivityResult (not in system ap i jar yet). | |
| 1756 // crbug.com/543272. | |
| 1757 public void onActivityResult(final int requestCode, final int resultCode, fi nal Intent data) { | |
| 1758 if (checkNeedsPost()) { | |
| 1759 mRunQueue.addTask(new Runnable() { | |
| 1760 @Override | |
| 1761 public void run() { | |
| 1762 onActivityResult(requestCode, resultCode, data); | |
| 1763 } | |
| 1764 }); | |
| 1765 return; | |
| 1766 } | |
| 1767 mAwContents.onActivityResult(requestCode, resultCode, data); | |
| 1768 } | |
| 1769 | |
| 1753 @Override | 1770 @Override |
| 1754 public boolean performLongClick() { | 1771 public boolean performLongClick() { |
| 1755 // Return false unless the WebView is attached to a View with a parent | 1772 // Return false unless the WebView is attached to a View with a parent |
| 1756 return mWebView.getParent() != null ? mWebViewPrivate.super_performLongC lick() : false; | 1773 return mWebView.getParent() != null ? mWebViewPrivate.super_performLongC lick() : false; |
| 1757 } | 1774 } |
| 1758 | 1775 |
| 1759 @Override | 1776 @Override |
| 1760 public void onConfigurationChanged(final Configuration newConfig) { | 1777 public void onConfigurationChanged(final Configuration newConfig) { |
| 1761 if (checkNeedsPost()) { | 1778 if (checkNeedsPost()) { |
| 1762 mRunQueue.addTask(new Runnable() { | 1779 mRunQueue.addTask(new Runnable() { |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2238 public void super_onConfigurationChanged(Configuration arg0) { | 2255 public void super_onConfigurationChanged(Configuration arg0) { |
| 2239 // Intentional no-op | 2256 // Intentional no-op |
| 2240 } | 2257 } |
| 2241 | 2258 |
| 2242 @Override | 2259 @Override |
| 2243 public int super_getScrollBarStyle() { | 2260 public int super_getScrollBarStyle() { |
| 2244 return mWebViewPrivate.super_getScrollBarStyle(); | 2261 return mWebViewPrivate.super_getScrollBarStyle(); |
| 2245 } | 2262 } |
| 2246 | 2263 |
| 2247 @Override | 2264 @Override |
| 2265 public void super_startActivityForResult(Intent intent, int requestCode) { | |
| 2266 // TODO(hush): Use mWebViewPrivate.super_startActivityForResult | |
| 2267 // after N release. crbug.com/543272. | |
| 2268 try { | |
| 2269 Method startActivityForResultMethod = | |
| 2270 View.class.getMethod("startActivityForResult", Intent.cl ass, int.class); | |
| 2271 startActivityForResultMethod.invoke(mWebView, intent, requestCod e); | |
| 2272 } catch (Exception e) { | |
|
boliu
2015/10/21 00:22:17
This might catch things not related to reflection?
hush (inactive)
2015/10/21 01:23:24
If we have to be exact, it is going to be a whole
| |
| 2273 throw new RuntimeException("Invalid reflection", e); | |
| 2274 } | |
| 2275 } | |
| 2276 | |
| 2277 @Override | |
| 2248 public boolean awakenScrollBars() { | 2278 public boolean awakenScrollBars() { |
| 2249 mWebViewPrivate.awakenScrollBars(0); | 2279 mWebViewPrivate.awakenScrollBars(0); |
| 2250 // TODO: modify the WebView.PrivateAccess to provide a return value. | 2280 // TODO: modify the WebView.PrivateAccess to provide a return value. |
| 2251 return true; | 2281 return true; |
| 2252 } | 2282 } |
| 2253 | 2283 |
| 2254 @Override | 2284 @Override |
| 2255 public boolean super_awakenScrollBars(int arg0, boolean arg1) { | 2285 public boolean super_awakenScrollBars(int arg0, boolean arg1) { |
| 2256 return false; | 2286 return false; |
| 2257 } | 2287 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2293 mAwContents.extractSmartClipData(x, y, width, height); | 2323 mAwContents.extractSmartClipData(x, y, width, height); |
| 2294 } | 2324 } |
| 2295 | 2325 |
| 2296 // Implements SmartClipProvider | 2326 // Implements SmartClipProvider |
| 2297 @Override | 2327 @Override |
| 2298 public void setSmartClipResultHandler(final Handler resultHandler) { | 2328 public void setSmartClipResultHandler(final Handler resultHandler) { |
| 2299 checkThread(); | 2329 checkThread(); |
| 2300 mAwContents.setSmartClipResultHandler(resultHandler); | 2330 mAwContents.setSmartClipResultHandler(resultHandler); |
| 2301 } | 2331 } |
| 2302 } | 2332 } |
| OLD | NEW |