Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java

Issue 52463004: Block media loading when AwSettings.setBlockNetworkLoads is true. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable failed test Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.android_webview;
6
7 import android.content.Context;
8 import android.view.KeyEvent;
9 import android.view.View;
10 import android.webkit.URLUtil;
11 import android.webkit.WebChromeClient;
12
13 import org.chromium.content.browser.ContentVideoView;
14 import org.chromium.content.browser.ContentVideoViewClient;
15 import org.chromium.content.browser.ContentVideoViewControls;
16 import org.chromium.content.browser.ContentViewClient;
17
18 /**
19 * ContentViewClient implementation for WebView
20 */
21 public class AwContentViewClient extends ContentViewClient {
22
23 private class AwContentVideoViewClient implements ContentVideoViewClient {
24 @Override
25 public void onShowCustomView(View view) {
26 WebChromeClient.CustomViewCallback cb = new WebChromeClient.CustomVi ewCallback() {
27 @Override
28 public void onCustomViewHidden() {
29 ContentVideoView contentVideoView = ContentVideoView.getCont entVideoView();
30 if (contentVideoView != null)
31 contentVideoView.exitFullscreen(false);
32 }
33 };
34 mAwContentsClient.onShowCustomView(view, cb);
35 }
36
37 @Override
38 public void onDestroyContentVideoView() {
39 mAwContentsClient.onHideCustomView();
40 }
41
42 @Override
43 public View getVideoLoadingProgressView() {
44 return mAwContentsClient.getVideoLoadingProgressView();
45 }
46
47 @Override
48 public ContentVideoViewControls createControls() {
49 return null;
50 }
51 }
52
53 private AwContentsClient mAwContentsClient;
54 private AwSettings mAwSettings;
55
56 public AwContentViewClient(AwContentsClient awContentsClient, AwSettings awS ettings) {
57 mAwContentsClient = awContentsClient;
58 mAwSettings = awSettings;
59 }
60
61 @Override
62 public void onBackgroundColorChanged(int color) {
63 mAwContentsClient.onBackgroundColorChanged(color);
64 }
65
66 @Override
67 public void onStartContentIntent(Context context, String contentUrl) {
68 // Callback when detecting a click on a content link.
69 mAwContentsClient.shouldOverrideUrlLoading(contentUrl);
70 }
71
72 @Override
73 public void onUpdateTitle(String title) {
74 mAwContentsClient.onReceivedTitle(title);
75 }
76
77 @Override
78 public boolean shouldOverrideKeyEvent(KeyEvent event) {
79 return mAwContentsClient.shouldOverrideKeyEvent(event);
80 }
81
82 @Override
83 final public ContentVideoViewClient getContentVideoViewClient() {
84 return new AwContentVideoViewClient();
85 }
86
87 @Override
88 public boolean shouldBlockMediaRequest(String url) {
89 return mAwSettings != null ?
90 mAwSettings.getBlockNetworkLoads() && URLUtil.isNetworkUrl(url) : true;
91 }
92 }
OLDNEW
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698