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

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

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: view_root.java_obj_... Created 3 years, 11 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_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;
(...skipping 19 matching lines...) Expand all
30 import org.chromium.content.browser.ContentVideoViewEmbedder; 30 import org.chromium.content.browser.ContentVideoViewEmbedder;
31 import org.chromium.content.browser.ContentView; 31 import org.chromium.content.browser.ContentView;
32 import org.chromium.content.browser.ContentViewClient; 32 import org.chromium.content.browser.ContentViewClient;
33 import org.chromium.content.browser.ContentViewCore; 33 import org.chromium.content.browser.ContentViewCore;
34 import org.chromium.content.browser.ContentViewRenderView; 34 import org.chromium.content.browser.ContentViewRenderView;
35 import org.chromium.content_public.browser.ActionModeCallbackHelper; 35 import org.chromium.content_public.browser.ActionModeCallbackHelper;
36 import org.chromium.content_public.browser.LoadUrlParams; 36 import org.chromium.content_public.browser.LoadUrlParams;
37 import org.chromium.content_public.browser.NavigationController; 37 import org.chromium.content_public.browser.NavigationController;
38 import org.chromium.content_public.browser.WebContents; 38 import org.chromium.content_public.browser.WebContents;
39 import org.chromium.ui.base.ViewAndroidDelegate; 39 import org.chromium.ui.base.ViewAndroidDelegate;
40 import org.chromium.ui.base.ViewRoot;
40 import org.chromium.ui.base.WindowAndroid; 41 import org.chromium.ui.base.WindowAndroid;
41 42
42 /** 43 /**
43 * Container for the various UI components that make up a shell window. 44 * Container for the various UI components that make up a shell window.
44 */ 45 */
45 @JNINamespace("content") 46 @JNINamespace("content")
46 public class Shell extends LinearLayout { 47 public class Shell extends LinearLayout {
47 48
48 private static final long COMPLETED_PROGRESS_TIMEOUT_MS = 200; 49 private static final long COMPLETED_PROGRESS_TIMEOUT_MS = 200;
49 50
(...skipping 11 matching lines...) Expand all
61 private EditText mUrlTextView; 62 private EditText mUrlTextView;
62 private ImageButton mPrevButton; 63 private ImageButton mPrevButton;
63 private ImageButton mNextButton; 64 private ImageButton mNextButton;
64 private ImageButton mStopReloadButton; 65 private ImageButton mStopReloadButton;
65 66
66 private ClipDrawable mProgressDrawable; 67 private ClipDrawable mProgressDrawable;
67 68
68 private long mNativeShell; 69 private long mNativeShell;
69 private ContentViewRenderView mContentViewRenderView; 70 private ContentViewRenderView mContentViewRenderView;
70 private WindowAndroid mWindow; 71 private WindowAndroid mWindow;
72 private ViewRoot mViewRoot;
71 73
72 private boolean mLoading; 74 private boolean mLoading;
73 private boolean mIsFullscreen; 75 private boolean mIsFullscreen;
74 76
75 /** 77 /**
76 * Constructor for inflating via XML. 78 * Constructor for inflating via XML.
77 */ 79 */
78 public Shell(Context context, AttributeSet attrs) { 80 public Shell(Context context, AttributeSet attrs) {
79 super(context, attrs); 81 super(context, attrs);
80 } 82 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 public void close() { 120 public void close() {
119 if (mNativeShell == 0) return; 121 if (mNativeShell == 0) return;
120 nativeCloseShell(mNativeShell); 122 nativeCloseShell(mNativeShell);
121 } 123 }
122 124
123 @CalledByNative 125 @CalledByNative
124 private void onNativeDestroyed() { 126 private void onNativeDestroyed() {
125 mWindow = null; 127 mWindow = null;
126 mNativeShell = 0; 128 mNativeShell = 0;
127 mContentViewCore.destroy(); 129 mContentViewCore.destroy();
130 mViewRoot.destroy();
128 } 131 }
129 132
130 /** 133 /**
131 * @return Whether the Shell has been destroyed. 134 * @return Whether the Shell has been destroyed.
132 * @see #onNativeDestroyed() 135 * @see #onNativeDestroyed()
133 */ 136 */
134 public boolean isDestroyed() { 137 public boolean isDestroyed() {
135 return mNativeShell == 0; 138 return mNativeShell == 0;
136 } 139 }
137 140
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 * Initializes the ContentView based on the native tab contents pointer pass ed in. 293 * Initializes the ContentView based on the native tab contents pointer pass ed in.
291 * @param webContents A {@link WebContents} object. 294 * @param webContents A {@link WebContents} object.
292 */ 295 */
293 @SuppressWarnings("unused") 296 @SuppressWarnings("unused")
294 @CalledByNative 297 @CalledByNative
295 private void initFromNativeTabContents(WebContents webContents) { 298 private void initFromNativeTabContents(WebContents webContents) {
296 Context context = getContext(); 299 Context context = getContext();
297 mContentViewCore = new ContentViewCore(context, ""); 300 mContentViewCore = new ContentViewCore(context, "");
298 ContentView cv = ContentView.createContentView(context, mContentViewCore ); 301 ContentView cv = ContentView.createContentView(context, mContentViewCore );
299 mContentViewCore.initialize(ViewAndroidDelegate.createBasicDelegate(cv), cv, 302 mContentViewCore.initialize(ViewAndroidDelegate.createBasicDelegate(cv), cv,
300 webContents, mWindow); 303 webContents, ViewRoot.create(mWindow));
301 mContentViewCore.setActionModeCallback(defaultActionCallback()); 304 mContentViewCore.setActionModeCallback(defaultActionCallback());
302 mContentViewCore.setContentViewClient(mContentViewClient); 305 mContentViewCore.setContentViewClient(mContentViewClient);
303 mWebContents = mContentViewCore.getWebContents(); 306 mWebContents = mContentViewCore.getWebContents();
304 mNavigationController = mWebContents.getNavigationController(); 307 mNavigationController = mWebContents.getNavigationController();
305 if (getParent() != null) mContentViewCore.onShow(); 308 if (getParent() != null) mContentViewCore.onShow();
306 if (mWebContents.getUrl() != null) { 309 if (mWebContents.getUrl() != null) {
307 mUrlTextView.setText(mWebContents.getUrl()); 310 mUrlTextView.setText(mWebContents.getUrl());
308 } 311 }
309 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, 312 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv,
310 new FrameLayout.LayoutParams( 313 new FrameLayout.LayoutParams(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 Context.INPUT_METHOD_SERVICE); 407 Context.INPUT_METHOD_SERVICE);
405 if (visible) { 408 if (visible) {
406 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); 409 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT);
407 } else { 410 } else {
408 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); 411 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0);
409 } 412 }
410 } 413 }
411 414
412 private static native void nativeCloseShell(long shellPtr); 415 private static native void nativeCloseShell(long shellPtr);
413 } 416 }
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java ('k') | ui/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698