diff options
author | acleung@google.com <acleung@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-13 11:41:23 +0000 |
---|---|---|
committer | acleung@google.com <acleung@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-13 11:41:23 +0000 |
commit | 015e37054a505efcdff6823c31fceca470416270 (patch) | |
tree | 0201284a6db927ce484825423f174fb199c6cce2 /android_webview/java | |
parent | e67ebf3732f8122dfa8a2eddfc0ada8f37b92dab (diff) | |
download | chromium_src-015e37054a505efcdff6823c31fceca470416270.zip chromium_src-015e37054a505efcdff6823c31fceca470416270.tar.gz chromium_src-015e37054a505efcdff6823c31fceca470416270.tar.bz2 |
onShowCustomView
BUG=6295515
Review URL: https://chromiumcodereview.appspot.com/11280284
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/java')
3 files changed, 79 insertions, 0 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentVideoViewDelegate.java b/android_webview/java/src/org/chromium/android_webview/AwContentVideoViewDelegate.java new file mode 100644 index 0000000..dfa1e23 --- /dev/null +++ b/android_webview/java/src/org/chromium/android_webview/AwContentVideoViewDelegate.java @@ -0,0 +1,70 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.android_webview; + +import android.content.Context; +import android.content.pm.ActivityInfo; +import android.view.View; +import android.webkit.WebChromeClient.CustomViewCallback; + +import org.chromium.content.browser.ContentVideoViewContextDelegate; + +/** + * This further delegates the responsibility displaying full-screen video to the + * Webview client. + */ +public class AwContentVideoViewDelegate implements ContentVideoViewContextDelegate { + private AwContentsClient mAwContentsClient; + private Context mContext; + + public AwContentVideoViewDelegate(AwContentsClient client, Context context) { + mAwContentsClient = client; + mContext = context; + } + + public void onShowCustomView(View view) { + CustomViewCallback cb = new CustomViewCallback() { + @Override + public void onCustomViewHidden() { + // TODO: we need to invoke ContentVideoView.onDestroyContentVideoView() here. + } + }; + mAwContentsClient.onShowCustomView(view, + ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, + cb); + } + + public void onDestroyContentVideoView() { + } + + public Context getContext() { + return mContext; + } + + public String getPlayBackErrorText() { + return mContext.getString( + org.chromium.content.R.string.media_player_error_text_invalid_progressive_playback); + } + + public String getUnknownErrorText() { + return mContext.getString( + org.chromium.content.R.string.media_player_error_text_unknown); + } + + public String getErrorButton() { + return mContext.getString( + org.chromium.content.R.string.media_player_error_button); + } + + public String getErrorTitle() { + return mContext.getString( + org.chromium.content.R.string.media_player_error_title); + } + + public String getVideoLoadingText() { + return mContext.getString( + org.chromium.content.R.string.media_player_loading_video); + } +} diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 6dc7ccb..e0ada40 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -27,6 +27,7 @@ import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; import org.chromium.base.ThreadUtils; import org.chromium.content.browser.ContentSettings; +import org.chromium.content.browser.ContentVideoView; import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.LoadUrlParams; import org.chromium.content.browser.NavigationHistory; @@ -272,6 +273,9 @@ public class AwContents { mContentViewCore.getNativeContentViewCore()); mDIPScale = DeviceDisplayInfo.create(containerView.getContext()).getDIPScale(); + + ContentVideoView.registerContentVideoViewContextDelegate( + new AwContentVideoViewDelegate(contentsClient, containerView.getContext())); } public ContentViewCore getContentViewCore() { diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java index f7c4259..106c30e 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java @@ -13,9 +13,11 @@ import android.os.Looper; import android.os.Message; import android.util.Log; import android.view.KeyEvent; +import android.view.View; import android.webkit.ConsoleMessage; import android.webkit.GeolocationPermissions; import android.webkit.ValueCallback; +import android.webkit.WebChromeClient; import org.chromium.content.browser.ContentViewClient; import org.chromium.content.browser.ContentViewCore; @@ -282,6 +284,9 @@ public abstract class AwContentsClient extends ContentViewClient { public abstract void onReceivedError(int errorCode, String description, String failingUrl); + public abstract void onShowCustomView(View view, + int requestedOrientation, WebChromeClient.CustomViewCallback callback); + //-------------------------------------------------------------------------------------------- // Stuff that we ignore since it only makes sense for Chrome browser //-------------------------------------------------------------------------------------------- |