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.app.assist.AssistStructure.ViewNode; | 7 import android.app.assist.AssistStructure.ViewNode; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | |
| 9 import android.content.res.Configuration; | 10 import android.content.res.Configuration; |
| 10 import android.graphics.Bitmap; | 11 import android.graphics.Bitmap; |
| 11 import android.graphics.Canvas; | 12 import android.graphics.Canvas; |
| 12 import android.graphics.Paint; | 13 import android.graphics.Paint; |
| 13 import android.graphics.Picture; | 14 import android.graphics.Picture; |
| 14 import android.graphics.Rect; | 15 import android.graphics.Rect; |
| 15 import android.graphics.drawable.Drawable; | 16 import android.graphics.drawable.Drawable; |
| 16 import android.net.Uri; | 17 import android.net.Uri; |
| 17 import android.net.http.SslCertificate; | 18 import android.net.http.SslCertificate; |
| 18 import android.os.Build; | 19 import android.os.Build; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 import org.chromium.android_webview.AwSettings; | 54 import org.chromium.android_webview.AwSettings; |
| 54 import org.chromium.base.ThreadUtils; | 55 import org.chromium.base.ThreadUtils; |
| 55 import org.chromium.base.annotations.SuppressFBWarnings; | 56 import org.chromium.base.annotations.SuppressFBWarnings; |
| 56 import org.chromium.content.browser.SmartClipProvider; | 57 import org.chromium.content.browser.SmartClipProvider; |
| 57 import org.chromium.content_public.browser.AccessibilitySnapshotCallback; | 58 import org.chromium.content_public.browser.AccessibilitySnapshotCallback; |
| 58 import org.chromium.content_public.browser.AccessibilitySnapshotNode; | 59 import org.chromium.content_public.browser.AccessibilitySnapshotNode; |
| 59 import org.chromium.content_public.browser.NavigationHistory; | 60 import org.chromium.content_public.browser.NavigationHistory; |
| 60 | 61 |
| 61 import java.io.BufferedWriter; | 62 import java.io.BufferedWriter; |
| 62 import java.io.File; | 63 import java.io.File; |
| 64 import java.lang.reflect.Method; | |
| 63 import java.util.Iterator; | 65 import java.util.Iterator; |
| 64 import java.util.Map; | 66 import java.util.Map; |
| 65 import java.util.Queue; | 67 import java.util.Queue; |
| 66 import java.util.concurrent.Callable; | 68 import java.util.concurrent.Callable; |
| 67 import java.util.concurrent.ConcurrentLinkedQueue; | 69 import java.util.concurrent.ConcurrentLinkedQueue; |
| 68 import java.util.concurrent.FutureTask; | 70 import java.util.concurrent.FutureTask; |
| 69 import java.util.concurrent.TimeUnit; | 71 import java.util.concurrent.TimeUnit; |
| 70 | 72 |
| 71 /** | 73 /** |
| 72 * This class is the delegate to which WebViewProxy forwards all API calls. | 74 * This class is the delegate to which WebViewProxy forwards all API calls. |
| (...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1739 @Override | 1741 @Override |
| 1740 public void run() { | 1742 public void run() { |
| 1741 mAwContents.setLayoutParams(layoutParams); | 1743 mAwContents.setLayoutParams(layoutParams); |
| 1742 } | 1744 } |
| 1743 }); | 1745 }); |
| 1744 return; | 1746 return; |
| 1745 } | 1747 } |
| 1746 mAwContents.setLayoutParams(layoutParams); | 1748 mAwContents.setLayoutParams(layoutParams); |
| 1747 } | 1749 } |
| 1748 | 1750 |
| 1751 // Overrides WebViewProvider.ViewDelegate.onActivityResult (not in system ap i jar yet). | |
| 1752 public void onActivityResult(final int requestCode, final int resultCode, fi nal Intent data) { | |
| 1753 if (checkNeedsPost()) { | |
| 1754 mRunQueue.addTask(new Runnable() { | |
| 1755 @Override | |
| 1756 public void run() { | |
| 1757 onActivityResult(requestCode, resultCode, data); | |
| 1758 } | |
| 1759 }); | |
| 1760 return; | |
| 1761 } | |
| 1762 mAwContents.onActivityResult(requestCode, resultCode, data); | |
| 1763 } | |
| 1764 | |
| 1749 @Override | 1765 @Override |
| 1750 public boolean performLongClick() { | 1766 public boolean performLongClick() { |
| 1751 // Return false unless the WebView is attached to a View with a parent | 1767 // Return false unless the WebView is attached to a View with a parent |
| 1752 return mWebView.getParent() != null ? mWebViewPrivate.super_performLongC lick() : false; | 1768 return mWebView.getParent() != null ? mWebViewPrivate.super_performLongC lick() : false; |
| 1753 } | 1769 } |
| 1754 | 1770 |
| 1755 @Override | 1771 @Override |
| 1756 public void onConfigurationChanged(final Configuration newConfig) { | 1772 public void onConfigurationChanged(final Configuration newConfig) { |
| 1757 if (checkNeedsPost()) { | 1773 if (checkNeedsPost()) { |
| 1758 mRunQueue.addTask(new Runnable() { | 1774 mRunQueue.addTask(new Runnable() { |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2233 public void super_onConfigurationChanged(Configuration arg0) { | 2249 public void super_onConfigurationChanged(Configuration arg0) { |
| 2234 // Intentional no-op | 2250 // Intentional no-op |
| 2235 } | 2251 } |
| 2236 | 2252 |
| 2237 @Override | 2253 @Override |
| 2238 public int super_getScrollBarStyle() { | 2254 public int super_getScrollBarStyle() { |
| 2239 return mWebViewPrivate.super_getScrollBarStyle(); | 2255 return mWebViewPrivate.super_getScrollBarStyle(); |
| 2240 } | 2256 } |
| 2241 | 2257 |
| 2242 @Override | 2258 @Override |
| 2259 public void super_startActivityForResult(Intent intent, int requestCode) { | |
| 2260 // TODO(hush): Use mWebViewPrivate.super_startActivityForResult afte r N release. | |
|
sgurun-gerrit only
2015/10/14 17:40:13
add this as a second clean up item in the bug I me
hush (inactive)
2015/10/14 21:33:58
Done.
| |
| 2261 try { | |
| 2262 Method startActivityForResultMethod = | |
| 2263 View.class.getMethod("startActivityForResult", Intent.cl ass, int.class); | |
| 2264 startActivityForResultMethod.invoke(mWebView, intent, requestCod e); | |
| 2265 } catch (Exception e) { | |
| 2266 throw new RuntimeException("Invalid reflection", e); | |
|
Torne
2015/10/14 13:42:58
Maybe you should API-level guard this function for
sgurun-gerrit only
2015/10/14 17:40:13
+1
also note that, in theory, which api level you
hush (inactive)
2015/10/14 21:33:58
View#startActivityForResult will work in M. WebVie
hush (inactive)
2015/10/14 21:33:58
This is function can only be called on M+ because
| |
| 2267 } | |
| 2268 } | |
| 2269 | |
| 2270 @Override | |
| 2243 public boolean awakenScrollBars() { | 2271 public boolean awakenScrollBars() { |
| 2244 mWebViewPrivate.awakenScrollBars(0); | 2272 mWebViewPrivate.awakenScrollBars(0); |
| 2245 // TODO: modify the WebView.PrivateAccess to provide a return value. | 2273 // TODO: modify the WebView.PrivateAccess to provide a return value. |
| 2246 return true; | 2274 return true; |
| 2247 } | 2275 } |
| 2248 | 2276 |
| 2249 @Override | 2277 @Override |
| 2250 public boolean super_awakenScrollBars(int arg0, boolean arg1) { | 2278 public boolean super_awakenScrollBars(int arg0, boolean arg1) { |
| 2251 return false; | 2279 return false; |
| 2252 } | 2280 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2288 mAwContents.extractSmartClipData(x, y, width, height); | 2316 mAwContents.extractSmartClipData(x, y, width, height); |
| 2289 } | 2317 } |
| 2290 | 2318 |
| 2291 // Implements SmartClipProvider | 2319 // Implements SmartClipProvider |
| 2292 @Override | 2320 @Override |
| 2293 public void setSmartClipResultHandler(final Handler resultHandler) { | 2321 public void setSmartClipResultHandler(final Handler resultHandler) { |
| 2294 checkThread(); | 2322 checkThread(); |
| 2295 mAwContents.setSmartClipResultHandler(resultHandler); | 2323 mAwContents.setSmartClipResultHandler(resultHandler); |
| 2296 } | 2324 } |
| 2297 } | 2325 } |
| OLD | NEW |