ac3f96ea58a7fbd90c54cdfd35bce3ca7bfbee4d
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / android / core / src / org / xwalk / core / 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;
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.XWalkWebChromeClient.CustomViewCallback;
16
17 class XWalkContentVideoViewClient implements ContentVideoViewClient {
18     private XWalkContentsClient mContentsClient;
19     private Activity mActivity;
20     private XWalkView mView;
21
22     public XWalkContentVideoViewClient(XWalkContentsClient client, Activity activity, XWalkView view) {
23         mContentsClient = client;
24         mActivity = activity;
25         mView = view;
26     }
27
28     @Override
29     public void 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     }
42
43     @Override
44     public void onDestroyContentVideoView() {
45         if (!CommandLine.getInstance().hasSwitch(
46                 ContentSwitches.DISABLE_OVERLAY_FULLSCREEN_VIDEO_SUBTITLE)) {
47             mView.setOverlayVideoMode(false);
48         }
49         mContentsClient.onHideCustomView();
50     }
51
52     @Override
53     public View getVideoLoadingProgressView() {
54         return mContentsClient.getVideoLoadingProgressView();
55     }
56 }