| 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_shell; | 5 package org.chromium.content_shell; |
| 6 | 6 |
| 7 import android.app.Activity; |
| 7 import android.content.Context; | 8 import android.content.Context; |
| 8 import android.graphics.drawable.ClipDrawable; | 9 import android.graphics.drawable.ClipDrawable; |
| 9 import android.text.TextUtils; | 10 import android.text.TextUtils; |
| 10 import android.util.AttributeSet; | 11 import android.util.AttributeSet; |
| 11 import android.view.KeyEvent; | 12 import android.view.KeyEvent; |
| 12 import android.view.View; | 13 import android.view.View; |
| 13 import android.view.ViewGroup; | 14 import android.view.ViewGroup; |
| 14 import android.view.inputmethod.EditorInfo; | 15 import android.view.inputmethod.EditorInfo; |
| 15 import android.view.inputmethod.InputMethodManager; | 16 import android.view.inputmethod.InputMethodManager; |
| 16 import android.widget.EditText; | 17 import android.widget.EditText; |
| 17 import android.widget.FrameLayout; | 18 import android.widget.FrameLayout; |
| 18 import android.widget.ImageButton; | 19 import android.widget.ImageButton; |
| 19 import android.widget.LinearLayout; | 20 import android.widget.LinearLayout; |
| 20 import android.widget.TextView; | 21 import android.widget.TextView; |
| 21 import android.widget.TextView.OnEditorActionListener; | 22 import android.widget.TextView.OnEditorActionListener; |
| 22 | 23 |
| 23 import org.chromium.base.annotations.CalledByNative; | 24 import org.chromium.base.annotations.CalledByNative; |
| 24 import org.chromium.base.annotations.JNINamespace; | 25 import org.chromium.base.annotations.JNINamespace; |
| 26 import org.chromium.content.browser.ActivityContentVideoViewEmbedder; |
| 27 import org.chromium.content.browser.ContentVideoViewEmbedder; |
| 25 import org.chromium.content.browser.ContentView; | 28 import org.chromium.content.browser.ContentView; |
| 26 import org.chromium.content.browser.ContentViewClient; | 29 import org.chromium.content.browser.ContentViewClient; |
| 27 import org.chromium.content.browser.ContentViewCore; | 30 import org.chromium.content.browser.ContentViewCore; |
| 28 import org.chromium.content.browser.ContentViewRenderView; | 31 import org.chromium.content.browser.ContentViewRenderView; |
| 29 import org.chromium.content_public.browser.LoadUrlParams; | 32 import org.chromium.content_public.browser.LoadUrlParams; |
| 30 import org.chromium.content_public.browser.NavigationController; | 33 import org.chromium.content_public.browser.NavigationController; |
| 31 import org.chromium.content_public.browser.WebContents; | 34 import org.chromium.content_public.browser.WebContents; |
| 32 import org.chromium.ui.base.ViewAndroidDelegate; | 35 import org.chromium.ui.base.ViewAndroidDelegate; |
| 33 import org.chromium.ui.base.WindowAndroid; | 36 import org.chromium.ui.base.WindowAndroid; |
| 34 | 37 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 mUrlTextView.setText(mWebContents.getUrl()); | 302 mUrlTextView.setText(mWebContents.getUrl()); |
| 300 } | 303 } |
| 301 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, | 304 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, |
| 302 new FrameLayout.LayoutParams( | 305 new FrameLayout.LayoutParams( |
| 303 FrameLayout.LayoutParams.MATCH_PARENT, | 306 FrameLayout.LayoutParams.MATCH_PARENT, |
| 304 FrameLayout.LayoutParams.MATCH_PARENT)); | 307 FrameLayout.LayoutParams.MATCH_PARENT)); |
| 305 cv.requestFocus(); | 308 cv.requestFocus(); |
| 306 mContentViewRenderView.setCurrentContentViewCore(mContentViewCore); | 309 mContentViewRenderView.setCurrentContentViewCore(mContentViewCore); |
| 307 } | 310 } |
| 308 | 311 |
| 312 @CalledByNative |
| 313 public ContentVideoViewEmbedder getContentVideoViewEmbedder() { |
| 314 return new ActivityContentVideoViewEmbedder((Activity) getContext()) { |
| 315 @Override |
| 316 public void enterFullscreenVideo(View view, boolean isVideoLoaded) { |
| 317 super.enterFullscreenVideo(view, isVideoLoaded); |
| 318 mContentViewRenderView.setOverlayVideoMode(true); |
| 319 } |
| 320 |
| 321 @Override |
| 322 public void exitFullscreenVideo() { |
| 323 super.exitFullscreenVideo(); |
| 324 mContentViewRenderView.setOverlayVideoMode(false); |
| 325 } |
| 326 }; |
| 327 } |
| 328 |
| 309 /** | 329 /** |
| 310 * Enable/Disable navigation(Prev/Next) button if navigation is allowed/disa
llowed | 330 * Enable/Disable navigation(Prev/Next) button if navigation is allowed/disa
llowed |
| 311 * in respective direction. | 331 * in respective direction. |
| 312 * @param controlId Id of button to update | 332 * @param controlId Id of button to update |
| 313 * @param enabled enable/disable value | 333 * @param enabled enable/disable value |
| 314 */ | 334 */ |
| 315 @CalledByNative | 335 @CalledByNative |
| 316 private void enableUiControl(int controlId, boolean enabled) { | 336 private void enableUiControl(int controlId, boolean enabled) { |
| 317 if (controlId == 0) { | 337 if (controlId == 0) { |
| 318 mPrevButton.setEnabled(enabled); | 338 mPrevButton.setEnabled(enabled); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 347 Context.INPUT_METHOD_SERVICE); | 367 Context.INPUT_METHOD_SERVICE); |
| 348 if (visible) { | 368 if (visible) { |
| 349 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 369 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
| 350 } else { | 370 } else { |
| 351 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 371 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
| 352 } | 372 } |
| 353 } | 373 } |
| 354 | 374 |
| 355 private static native void nativeCloseShell(long shellPtr); | 375 private static native void nativeCloseShell(long shellPtr); |
| 356 } | 376 } |
| OLD | NEW |