OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.view.KeyEvent; | 8 import android.view.KeyEvent; |
9 import android.view.View; | 9 import android.view.View; |
10 import android.webkit.URLUtil; | 10 import android.webkit.URLUtil; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 @Override | 81 @Override |
82 public void exitFullscreenVideo() { | 82 public void exitFullscreenVideo() { |
83 exitFullscreen(); | 83 exitFullscreen(); |
84 } | 84 } |
85 | 85 |
86 @Override | 86 @Override |
87 public View getVideoLoadingProgressView() { | 87 public View getVideoLoadingProgressView() { |
88 return mAwContentsClient.getVideoLoadingProgressView(); | 88 return mAwContentsClient.getVideoLoadingProgressView(); |
89 } | 89 } |
90 | 90 |
91 @Override | 91 /** |
| 92 * Called when a non-video element has entered fullscreen. For video element
s see |
| 93 * {@link ContentVideoViewClient#enterFullscreenVideo(android.view.View)}. |
| 94 */ |
92 public void enterFullscreen() { | 95 public void enterFullscreen() { |
93 WebChromeClient.CustomViewCallback cb = new WebChromeClient.CustomViewCa
llback() { | 96 WebChromeClient.CustomViewCallback cb = new WebChromeClient.CustomViewCa
llback() { |
94 @Override | 97 @Override |
95 public void onCustomViewHidden() { | 98 public void onCustomViewHidden() { |
96 mAwContents.requestExitFullscreen(); | 99 mAwContents.requestExitFullscreen(); |
97 } | 100 } |
98 }; | 101 }; |
99 enterFullscreen(null, cb); | 102 enterFullscreen(null, cb); |
100 } | 103 } |
101 | 104 |
102 @Override | 105 /** |
| 106 * Called when a non-video element has exited fullscreen. For video elements
see |
| 107 * {@link ContentVideoViewClient#exitFullscreenVideo()}. |
| 108 */ |
103 public void exitFullscreen() { | 109 public void exitFullscreen() { |
104 mAwContents.exitFullScreen(); | 110 mAwContents.exitFullScreen(); |
105 mAwContentsClient.onHideCustomView(); | 111 mAwContentsClient.onHideCustomView(); |
106 } | 112 } |
107 | 113 |
108 private void enterFullscreen(View videoView, WebChromeClient.CustomViewCallb
ack cb) { | 114 private void enterFullscreen(View videoView, WebChromeClient.CustomViewCallb
ack cb) { |
109 if (mAwContents.isFullScreen()) { | 115 if (mAwContents.isFullScreen()) { |
110 return; | 116 return; |
111 } | 117 } |
112 View fullscreenView = mAwContents.enterFullScreen(); | 118 View fullscreenView = mAwContents.enterFullScreen(); |
113 if (fullscreenView == null) { | 119 if (fullscreenView == null) { |
114 return; | 120 return; |
115 } | 121 } |
116 | 122 |
117 if (videoView == null) { | 123 if (videoView == null) { |
118 // The fullscreenView contains the non-video element in fullscreen. | 124 // The fullscreenView contains the non-video element in fullscreen. |
119 mAwContentsClient.onShowCustomView(fullscreenView, cb); | 125 mAwContentsClient.onShowCustomView(fullscreenView, cb); |
120 } else { | 126 } else { |
121 // The videoView contains the video and the fullscreenView the html5
controls. | 127 // The videoView contains the video and the fullscreenView the html5
controls. |
122 FrameLayout viewGroup = new FrameLayout(mContext); | 128 FrameLayout viewGroup = new FrameLayout(mContext); |
123 viewGroup.addView(videoView); | 129 viewGroup.addView(videoView); |
124 viewGroup.addView(fullscreenView); | 130 viewGroup.addView(fullscreenView); |
125 mAwContentsClient.onShowCustomView(viewGroup, cb); | 131 mAwContentsClient.onShowCustomView(viewGroup, cb); |
126 } | 132 } |
127 } | 133 } |
128 } | 134 } |
OLD | NEW |