Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / android / core_internal / src / org / xwalk / core / internal / XWalkContentVideoViewClient.java
1 // Copyright (c) 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.xwalk.core.internal;
6
7 import android.app.Activity;
8 import android.content.Context;
9 import android.view.View;
10 import android.view.WindowManager;
11
12 import org.chromium.base.CommandLine;
13 import org.chromium.content.browser.ContentVideoView;
14 import org.chromium.content.browser.ContentVideoViewClient;
15 import org.chromium.content.common.ContentSwitches;
16 import org.xwalk.core.internal.XWalkWebChromeClient.CustomViewCallback;
17
18 class XWalkContentVideoViewClient implements ContentVideoViewClient {
19     private XWalkContentsClient mContentsClient;
20     private Activity mActivity;
21     private XWalkViewInternal mView;
22
23     public XWalkContentVideoViewClient(XWalkContentsClient client, Activity activity, XWalkViewInternal view) {
24         mContentsClient = client;
25         mActivity = activity;
26         mView = view;
27     }
28
29     @Override
30     public void enterFullscreenVideo(View view) {
31         mView.setOverlayVideoMode(true);
32         CustomViewCallback cb = new CustomViewCallback() {
33             @Override
34             public void onCustomViewHidden() {
35                 ContentVideoView contentVideoView = ContentVideoView.getContentVideoView();
36                 if (contentVideoView != null) contentVideoView.exitFullscreen(false);
37             }
38         };
39         mContentsClient.onShowCustomView(view, cb);
40     }
41
42     @Override
43     public void exitFullscreenVideo() {
44         mView.setOverlayVideoMode(false);
45         mContentsClient.onHideCustomView();
46     }
47
48     @Override
49     public View getVideoLoadingProgressView() {
50         return null;
51     }
52 }