Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 } |
| 428 ContentVideoView videoView = new ContentVideoView(context, nativeContent VideoView, client); | 429 ContentVideoViewClient client = contentViewCore.getContentVideoViewClien t(); |
| 430 ContentVideoView videoView = new ContentVideoView(context, nativeContent VideoView, | |
| 431 contentViewCore.getContentVideoViewClient()); | |
|
no sievers
2014/10/15 18:16:38
nit: contentViewCore.getContentVideoViewClient() -
Ignacio Solla
2014/10/15 18:38:42
Done.
| |
| 429 client.enterFullscreenVideo(videoView); | 432 client.enterFullscreenVideo(videoView); |
| 430 return videoView; | 433 return videoView; |
| 431 } | 434 } |
| 432 | 435 |
| 433 private static boolean isActivityContext(Context context) { | 436 private static boolean isActivityContext(Context context) { |
| 434 // Only retrieve the base context if the supplied context is a ContextWr apper but not | 437 // 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. | 438 // an Activity, given that Activity is already a subclass of ContextWrap per. |
| 436 if (context instanceof ContextWrapper && !(context instanceof Activity)) { | 439 if (context instanceof ContextWrapper && !(context instanceof Activity)) { |
| 437 context = ((ContextWrapper) context).getBaseContext(); | 440 context = ((ContextWrapper) context).getBaseContext(); |
| 438 } | 441 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 private native void nativePlay(long nativeContentVideoView); | 548 private native void nativePlay(long nativeContentVideoView); |
| 546 private native void nativeSeekTo(long nativeContentVideoView, int msec); | 549 private native void nativeSeekTo(long nativeContentVideoView, int msec); |
| 547 private native void nativeSetSurface(long nativeContentVideoView, Surface su rface); | 550 private native void nativeSetSurface(long nativeContentVideoView, Surface su rface); |
| 548 private native void nativeRecordFullscreenPlayback( | 551 private native void nativeRecordFullscreenPlayback( |
| 549 long nativeContentVideoView, boolean isVideoPortrait, boolean isOrie ntationPortrait); | 552 long nativeContentVideoView, boolean isVideoPortrait, boolean isOrie ntationPortrait); |
| 550 private native void nativeRecordExitFullscreenPlayback( | 553 private native void nativeRecordExitFullscreenPlayback( |
| 551 long nativeContentVideoView, boolean isOrientationPortrait, | 554 long nativeContentVideoView, boolean isOrientationPortrait, |
| 552 long playbackDurationBeforeOrientationChange, | 555 long playbackDurationBeforeOrientationChange, |
| 553 long playbackDurationAfterOrientationChange); | 556 long playbackDurationAfterOrientationChange); |
| 554 } | 557 } |
| OLD | NEW |