Upstream version 8.36.169.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.ContentVideoViewClient;
14 import org.chromium.content.common.ContentSwitches;
15 import org.xwalk.core.internal.XWalkWebChromeClient.CustomViewCallback;
16
17 class XWalkContentVideoViewClient implements ContentVideoViewClient {
18     private XWalkContentsClient mContentsClient;
19     private Activity mActivity;
20     private XWalkViewInternal mView;
21
22     public XWalkContentVideoViewClient(XWalkContentsClient client, Activity activity, XWalkViewInternal view) {
23         mContentsClient = client;
24         mActivity = activity;
25         mView = view;
26     }
27
28     @Override
29     public boolean onShowCustomView(View view) {
30         if (!CommandLine.getInstance().hasSwitch(
31                 ContentSwitches.DISABLE_OVERLAY_FULLSCREEN_VIDEO_SUBTITLE)) {
32             mView.setOverlayVideoMode(true);
33         }
34
35         CustomViewCallback cb = new CustomViewCallback() {
36             @Override
37             public void onCustomViewHidden() {
38             }
39         };
40         mContentsClient.onShowCustomView(view, cb);
41         return true;
42     }
43
44     @Override
45     public void onDestroyContentVideoView() {
46         if (!CommandLine.getInstance().hasSwitch(
47                 ContentSwitches.DISABLE_OVERLAY_FULLSCREEN_VIDEO_SUBTITLE)) {
48             mView.setOverlayVideoMode(false);
49         }
50         mContentsClient.onHideCustomView();
51     }
52
53     @Override
54     public View getVideoLoadingProgressView() {
55         return null;
56     }
57 }