Upstream version 11.39.250.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 boolean onShowCustomView(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         return true;
41     }
42
43     @Override
44     public void onDestroyContentVideoView() {
45         mView.setOverlayVideoMode(false);
46         mContentsClient.onHideCustomView();
47     }
48
49     @Override
50     public View getVideoLoadingProgressView() {
51         return null;
52     }
53 }