Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java

Issue 618013003: Support fullscreen for non-video elements in the WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactorFullscreenNonMedia
Patch Set: Fix failing test Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.AlertDialog; 8 import android.app.AlertDialog;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.ContextWrapper; 10 import android.content.ContextWrapper;
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 nativeSeekTo(mNativeContentVideoView, msec); 411 nativeSeekTo(mNativeContentVideoView, msec);
412 } 412 }
413 } 413 }
414 414
415 public boolean isPlaying() { 415 public boolean isPlaying() {
416 return mNativeContentVideoView != 0 && nativeIsPlaying(mNativeContentVid eoView); 416 return mNativeContentVideoView != 0 && nativeIsPlaying(mNativeContentVid eoView);
417 } 417 }
418 418
419 @CalledByNative 419 @CalledByNative
420 private static ContentVideoView createContentVideoView( 420 private static ContentVideoView createContentVideoView(
421 Context context, long nativeContentVideoView, ContentVideoViewClient client) { 421 ContentViewCore contentViewCore, long nativeContentVideoView) {
422 ThreadUtils.assertOnUiThread(); 422 ThreadUtils.assertOnUiThread();
423 // The context needs be Activity to create the ContentVideoView correctl y. 423 // The context needs be Activity to create the ContentVideoView correctl y.
424 Context context = contentViewCore.getContext();
424 if (!isActivityContext(context)) { 425 if (!isActivityContext(context)) {
425 Log.e(TAG, "Wrong type of context, can't create fullscreen video"); 426 Log.e(TAG, "Wrong type of context, can't create fullscreen video");
426 return null; 427 return null;
427 } 428 }
429 ContentVideoViewClient client = contentViewCore.getContentVideoViewClien t();
428 ContentVideoView videoView = new ContentVideoView(context, nativeContent VideoView, client); 430 ContentVideoView videoView = new ContentVideoView(context, nativeContent VideoView, client);
429 client.enterFullscreenVideo(videoView); 431 client.enterFullscreenVideo(videoView);
430 return videoView; 432 return videoView;
431 } 433 }
432 434
433 private static boolean isActivityContext(Context context) { 435 private static boolean isActivityContext(Context context) {
434 // Only retrieve the base context if the supplied context is a ContextWr apper but not 436 // Only retrieve the base context if the supplied context is a ContextWr apper but not
435 // an Activity, given that Activity is already a subclass of ContextWrap per. 437 // an Activity, given that Activity is already a subclass of ContextWrap per.
436 if (context instanceof ContextWrapper && !(context instanceof Activity)) { 438 if (context instanceof ContextWrapper && !(context instanceof Activity)) {
437 context = ((ContextWrapper) context).getBaseContext(); 439 context = ((ContextWrapper) context).getBaseContext();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 private native void nativePlay(long nativeContentVideoView); 547 private native void nativePlay(long nativeContentVideoView);
546 private native void nativeSeekTo(long nativeContentVideoView, int msec); 548 private native void nativeSeekTo(long nativeContentVideoView, int msec);
547 private native void nativeSetSurface(long nativeContentVideoView, Surface su rface); 549 private native void nativeSetSurface(long nativeContentVideoView, Surface su rface);
548 private native void nativeRecordFullscreenPlayback( 550 private native void nativeRecordFullscreenPlayback(
549 long nativeContentVideoView, boolean isVideoPortrait, boolean isOrie ntationPortrait); 551 long nativeContentVideoView, boolean isVideoPortrait, boolean isOrie ntationPortrait);
550 private native void nativeRecordExitFullscreenPlayback( 552 private native void nativeRecordExitFullscreenPlayback(
551 long nativeContentVideoView, boolean isOrientationPortrait, 553 long nativeContentVideoView, boolean isOrientationPortrait,
552 long playbackDurationBeforeOrientationChange, 554 long playbackDurationBeforeOrientationChange,
553 long playbackDurationAfterOrientationChange); 555 long playbackDurationAfterOrientationChange);
554 } 556 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698