OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.content.Context; | 7 import android.content.Context; |
8 import android.view.KeyEvent; | 8 import android.view.KeyEvent; |
9 import android.view.View; | 9 import android.view.View; |
10 import android.webkit.URLUtil; | 10 import android.webkit.URLUtil; |
11 import android.webkit.WebChromeClient; | 11 import android.webkit.WebChromeClient; |
12 import android.widget.FrameLayout; | 12 import android.widget.FrameLayout; |
13 | 13 |
14 import org.chromium.content.browser.ContentVideoViewClient; | 14 import org.chromium.content.browser.ContentVideoViewClient; |
15 import org.chromium.content.browser.ContentViewClient; | 15 import org.chromium.content.browser.ContentViewClient; |
16 import org.chromium.content.browser.WebActionMode; | |
17 import org.chromium.content.browser.WebActionModeCallback.ActionHandler; | |
18 | 16 |
19 /** | 17 /** |
20 * ContentViewClient implementation for WebView | 18 * ContentViewClient implementation for WebView |
21 */ | 19 */ |
22 public class AwContentViewClient extends ContentViewClient implements ContentVid
eoViewClient { | 20 public class AwContentViewClient extends ContentViewClient implements ContentVid
eoViewClient { |
23 private final AwContentsClient mAwContentsClient; | 21 private final AwContentsClient mAwContentsClient; |
24 private final AwSettings mAwSettings; | 22 private final AwSettings mAwSettings; |
25 private final AwContents mAwContents; | 23 private final AwContents mAwContents; |
26 private final Context mContext; | 24 private final Context mContext; |
27 private FrameLayout mCustomView; | 25 private FrameLayout mCustomView; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // The check below is reflecting Chrome's behavior and is a workarou
nd for | 61 // The check below is reflecting Chrome's behavior and is a workarou
nd for |
64 // http://b/7697782. | 62 // http://b/7697782. |
65 if (!ContentViewClient.shouldPropagateKey(event.getKeyCode())) retur
n true; | 63 if (!ContentViewClient.shouldPropagateKey(event.getKeyCode())) retur
n true; |
66 return mAwContentsClient.shouldOverrideKeyEvent(event); | 64 return mAwContentsClient.shouldOverrideKeyEvent(event); |
67 } | 65 } |
68 | 66 |
69 return super.shouldOverrideKeyEvent(event); | 67 return super.shouldOverrideKeyEvent(event); |
70 } | 68 } |
71 | 69 |
72 @Override | 70 @Override |
73 public WebActionMode startActionMode( | |
74 View view, ActionHandler actionHandler, boolean floating) { | |
75 return mAwContentsClient.startActionMode(view, actionHandler, floating); | |
76 } | |
77 | |
78 @Override | |
79 public boolean supportsFloatingActionMode() { | |
80 return mAwContentsClient.supportsFloatingActionMode(); | |
81 } | |
82 | |
83 @Override | |
84 public final ContentVideoViewClient getContentVideoViewClient() { | 71 public final ContentVideoViewClient getContentVideoViewClient() { |
85 return this; | 72 return this; |
86 } | 73 } |
87 | 74 |
88 @Override | 75 @Override |
89 public boolean shouldBlockMediaRequest(String url) { | 76 public boolean shouldBlockMediaRequest(String url) { |
90 return mAwSettings != null | 77 return mAwSettings != null |
91 ? mAwSettings.getBlockNetworkLoads() && URLUtil.isNetworkUrl(url
) : true; | 78 ? mAwSettings.getBlockNetworkLoads() && URLUtil.isNetworkUrl(url
) : true; |
92 } | 79 } |
93 | 80 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 mAwContents.exitFullScreen(); | 141 mAwContents.exitFullScreen(); |
155 mAwContentsClient.onHideCustomView(); | 142 mAwContentsClient.onHideCustomView(); |
156 } | 143 } |
157 } | 144 } |
158 | 145 |
159 @Override | 146 @Override |
160 public boolean isExternalScrollActive() { | 147 public boolean isExternalScrollActive() { |
161 return mAwContents.isSmoothScrollingActive(); | 148 return mAwContents.isSmoothScrollingActive(); |
162 } | 149 } |
163 } | 150 } |
OLD | NEW |