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

Side by Side Diff: content/shell/android/java/src/org/chromium/content_shell/Shell.java

Issue 2431753002: Mus experiment in content shell on Android.
Patch Set: Fix mac bot Created 4 years, 1 month 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_shell; 5 package org.chromium.content_shell;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.graphics.drawable.ClipDrawable; 9 import android.graphics.drawable.ClipDrawable;
10 import android.text.TextUtils; 10 import android.text.TextUtils;
11 import android.util.AttributeSet; 11 import android.util.AttributeSet;
12 import android.view.KeyEvent; 12 import android.view.KeyEvent;
13 import android.view.View; 13 import android.view.View;
14 import android.view.ViewGroup; 14 import android.view.ViewGroup;
15 import android.view.inputmethod.EditorInfo; 15 import android.view.inputmethod.EditorInfo;
16 import android.view.inputmethod.InputMethodManager; 16 import android.view.inputmethod.InputMethodManager;
17 import android.widget.EditText; 17 import android.widget.EditText;
18 import android.widget.FrameLayout; 18 import android.widget.FrameLayout;
19 import android.widget.ImageButton; 19 import android.widget.ImageButton;
20 import android.widget.LinearLayout; 20 import android.widget.LinearLayout;
21 import android.widget.TextView; 21 import android.widget.TextView;
22 import android.widget.TextView.OnEditorActionListener; 22 import android.widget.TextView.OnEditorActionListener;
23 import android.widget.Toast;
23 24
24 import org.chromium.base.annotations.CalledByNative; 25 import org.chromium.base.annotations.CalledByNative;
25 import org.chromium.base.annotations.JNINamespace; 26 import org.chromium.base.annotations.JNINamespace;
26 import org.chromium.content.browser.ActivityContentVideoViewEmbedder; 27 import org.chromium.content.browser.ActivityContentVideoViewEmbedder;
27 import org.chromium.content.browser.ContentVideoViewEmbedder; 28 import org.chromium.content.browser.ContentVideoViewEmbedder;
28 import org.chromium.content.browser.ContentView; 29 import org.chromium.content.browser.ContentView;
29 import org.chromium.content.browser.ContentViewClient; 30 import org.chromium.content.browser.ContentViewClient;
30 import org.chromium.content.browser.ContentViewCore; 31 import org.chromium.content.browser.ContentViewCore;
31 import org.chromium.content.browser.ContentViewRenderView; 32 import org.chromium.content.browser.ContentViewRenderView;
32 import org.chromium.content_public.browser.LoadUrlParams; 33 import org.chromium.content_public.browser.LoadUrlParams;
(...skipping 18 matching lines...) Expand all
51 }; 52 };
52 53
53 private ContentViewCore mContentViewCore; 54 private ContentViewCore mContentViewCore;
54 private WebContents mWebContents; 55 private WebContents mWebContents;
55 private NavigationController mNavigationController; 56 private NavigationController mNavigationController;
56 private ContentViewClient mContentViewClient; 57 private ContentViewClient mContentViewClient;
57 private EditText mUrlTextView; 58 private EditText mUrlTextView;
58 private ImageButton mPrevButton; 59 private ImageButton mPrevButton;
59 private ImageButton mNextButton; 60 private ImageButton mNextButton;
60 private ImageButton mStopReloadButton; 61 private ImageButton mStopReloadButton;
62 private ImageButton mMusButton;
61 63
62 private ClipDrawable mProgressDrawable; 64 private ClipDrawable mProgressDrawable;
63 65
64 private long mNativeShell; 66 private long mNativeShell;
65 private ContentViewRenderView mContentViewRenderView; 67 private ContentViewRenderView mContentViewRenderView;
66 private WindowAndroid mWindow; 68 private WindowAndroid mWindow;
67 69
68 private boolean mLoading = false; 70 private boolean mLoading = false;
69 private boolean mIsFullscreen = false; 71 private boolean mIsFullscreen = false;
70 72
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 237 }
236 }); 238 });
237 mStopReloadButton = (ImageButton) findViewById(R.id.stop_reload_button); 239 mStopReloadButton = (ImageButton) findViewById(R.id.stop_reload_button);
238 mStopReloadButton.setOnClickListener(new OnClickListener() { 240 mStopReloadButton.setOnClickListener(new OnClickListener() {
239 @Override 241 @Override
240 public void onClick(View v) { 242 public void onClick(View v) {
241 if (mLoading) mWebContents.stop(); 243 if (mLoading) mWebContents.stop();
242 else mNavigationController.reload(true); 244 else mNavigationController.reload(true);
243 } 245 }
244 }); 246 });
247 if (nativeShowMusDemoButton()) {
248 mMusButton = (ImageButton) findViewById(R.id.show_mus);
249 mMusButton.setVisibility(View.VISIBLE);
250 mMusButton.setOnClickListener(new OnClickListener() {
251 @Override
252 public void onClick(View v) {
253 Toast.makeText(getContext(), "Showing Mus demo", Toast.LENGT H_SHORT).show();
254 nativeStartMusDemo(mNativeShell);
255 }
256 });
257 }
245 } 258 }
246 259
247 @SuppressWarnings("unused") 260 @SuppressWarnings("unused")
248 @CalledByNative 261 @CalledByNative
249 private void onUpdateUrl(String url) { 262 private void onUpdateUrl(String url) {
250 mUrlTextView.setText(url); 263 mUrlTextView.setText(url);
251 } 264 }
252 265
253 @SuppressWarnings("unused") 266 @SuppressWarnings("unused")
254 @CalledByNative 267 @CalledByNative
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ ice( 379 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ ice(
367 Context.INPUT_METHOD_SERVICE); 380 Context.INPUT_METHOD_SERVICE);
368 if (visible) { 381 if (visible) {
369 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); 382 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT);
370 } else { 383 } else {
371 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); 384 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0);
372 } 385 }
373 } 386 }
374 387
375 private static native void nativeCloseShell(long shellPtr); 388 private static native void nativeCloseShell(long shellPtr);
389 private static native boolean nativeShowMusDemoButton();
390 private native void nativeStartMusDemo(long nativeShell);
376 } 391 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698