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

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

Issue 1278593004: Introduce ThreadedInputConnection behind a switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handles render crash and navigation Created 4 years, 10 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.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.SearchManager; 10 import android.app.SearchManager;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 public void navigationEntryCommitted() { 327 public void navigationEntryCommitted() {
328 determinedProcessVisibility(); 328 determinedProcessVisibility();
329 } 329 }
330 330
331 private void resetPopupsAndInput() { 331 private void resetPopupsAndInput() {
332 ContentViewCore contentViewCore = mWeakContentViewCore.get(); 332 ContentViewCore contentViewCore = mWeakContentViewCore.get();
333 if (contentViewCore == null) return; 333 if (contentViewCore == null) return;
334 contentViewCore.mIsMobileOptimizedHint = false; 334 contentViewCore.mIsMobileOptimizedHint = false;
335 contentViewCore.hidePopupsAndClearSelection(); 335 contentViewCore.hidePopupsAndClearSelection();
336 contentViewCore.resetScrollInProgress(); 336 contentViewCore.resetScrollInProgress();
337 contentViewCore.resetImeAdapter();
Ted C 2016/02/02 23:14:42 you can just do contentViewCore.mImeAdapter.reset(
Changwan Ryu 2016/02/11 16:21:07 Done.
Ted C 2016/02/17 19:09:33 Looks like this didn't land?
Changwan Ryu 2016/02/18 06:03:26 My bad, it's done now.
337 } 338 }
338 339
339 private void determinedProcessVisibility() { 340 private void determinedProcessVisibility() {
340 ContentViewCore contentViewCore = mWeakContentViewCore.get(); 341 ContentViewCore contentViewCore = mWeakContentViewCore.get();
341 if (contentViewCore == null) return; 342 if (contentViewCore == null) return;
342 // Signal to the process management logic that we can now rely on th e process 343 // Signal to the process management logic that we can now rely on th e process
343 // visibility signal for binding management. Before the navigation c ommits, its 344 // visibility signal for binding management. Before the navigation c ommits, its
344 // renderer is considered background even if the pending navigation happens in the 345 // renderer is considered background even if the pending navigation happens in the
345 // foreground renderer. 346 // foreground renderer.
346 ChildProcessLauncher.determinedVisibility(contentViewCore.getCurrent RenderProcessId()); 347 ChildProcessLauncher.determinedVisibility(contentViewCore.getCurrent RenderProcessId());
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 * onDetachedFromWindow() which is guaranteed to be called in Android WebVie w. 928 * onDetachedFromWindow() which is guaranteed to be called in Android WebVie w.
928 */ 929 */
929 public void destroy() { 930 public void destroy() {
930 if (mNativeContentViewCore != 0) { 931 if (mNativeContentViewCore != 0) {
931 nativeOnJavaContentViewCoreDestroyed(mNativeContentViewCore); 932 nativeOnJavaContentViewCoreDestroyed(mNativeContentViewCore);
932 } 933 }
933 mWebContentsObserver.destroy(); 934 mWebContentsObserver.destroy();
934 mWebContentsObserver = null; 935 mWebContentsObserver = null;
935 setSmartClipDataListener(null); 936 setSmartClipDataListener(null);
936 setZoomControlsDelegate(null); 937 setZoomControlsDelegate(null);
938 mImeAdapter.reset();
937 // TODO(igsolla): address TODO in ContentViewClient because ContentViewC lient is not 939 // TODO(igsolla): address TODO in ContentViewClient because ContentViewC lient is not
938 // currently a real Null Object. 940 // currently a real Null Object.
939 // 941 //
940 // Instead of deleting the client we use the Null Object pattern to avoi d null checks 942 // Instead of deleting the client we use the Null Object pattern to avoi d null checks
941 // in this class. 943 // in this class.
942 mContentViewClient = new ContentViewClient(); 944 mContentViewClient = new ContentViewClient();
943 mWebContents = null; 945 mWebContents = null;
944 mOverscrollRefreshHandler = null; 946 mOverscrollRefreshHandler = null;
945 mNativeContentViewCore = 0; 947 mNativeContentViewCore = 0;
946 mJavaScriptInterfaces.clear(); 948 mJavaScriptInterfaces.clear();
(...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after
3081 public void setSmartClipDataListener(SmartClipDataListener listener) { 3083 public void setSmartClipDataListener(SmartClipDataListener listener) {
3082 mSmartClipDataListener = listener; 3084 mSmartClipDataListener = listener;
3083 } 3085 }
3084 3086
3085 public void setBackgroundOpaque(boolean opaque) { 3087 public void setBackgroundOpaque(boolean opaque) {
3086 if (mNativeContentViewCore != 0) { 3088 if (mNativeContentViewCore != 0) {
3087 nativeSetBackgroundOpaque(mNativeContentViewCore, opaque); 3089 nativeSetBackgroundOpaque(mNativeContentViewCore, opaque);
3088 } 3090 }
3089 } 3091 }
3090 3092
3093 @VisibleForTesting
3094 public WebContentsObserver getWebContentsObserverForTest() {
3095 return mWebContentsObserver;
3096 }
3097
3091 /** 3098 /**
3092 * Offer a long press gesture to the embedding View, primarily for WebView c ompatibility. 3099 * Offer a long press gesture to the embedding View, primarily for WebView c ompatibility.
3093 * 3100 *
3094 * @return true if the embedder handled the event. 3101 * @return true if the embedder handled the event.
3095 */ 3102 */
3096 private boolean offerLongPressToEmbedder() { 3103 private boolean offerLongPressToEmbedder() {
3097 return mContainerView.performLongClick(); 3104 return mContainerView.performLongClick();
3098 } 3105 }
3099 3106
3100 /** 3107 /**
3101 * Reset scroll and fling accounting, notifying listeners as appropriate. 3108 * Reset scroll and fling accounting, notifying listeners as appropriate.
3102 * This is useful as a failsafe when the input stream may have been interrup ed. 3109 * This is useful as a failsafe when the input stream may have been interrup ed.
3103 */ 3110 */
3104 private void resetScrollInProgress() { 3111 private void resetScrollInProgress() {
3105 if (!isScrollInProgress()) return; 3112 if (!isScrollInProgress()) return;
3106 3113
3107 final boolean touchScrollInProgress = mTouchScrollInProgress; 3114 final boolean touchScrollInProgress = mTouchScrollInProgress;
3108 final int potentiallyActiveFlingCount = mPotentiallyActiveFlingCount; 3115 final int potentiallyActiveFlingCount = mPotentiallyActiveFlingCount;
3109 3116
3110 setTouchScrollInProgress(false); 3117 setTouchScrollInProgress(false);
3111 mPotentiallyActiveFlingCount = 0; 3118 mPotentiallyActiveFlingCount = 0;
3112 if (touchScrollInProgress) updateGestureStateListener(GestureEventType.S CROLL_END); 3119 if (touchScrollInProgress) updateGestureStateListener(GestureEventType.S CROLL_END);
3113 if (potentiallyActiveFlingCount > 0) updateGestureStateListener(GestureE ventType.FLING_END); 3120 if (potentiallyActiveFlingCount > 0) updateGestureStateListener(GestureE ventType.FLING_END);
3114 } 3121 }
3115 3122
3123 private void resetImeAdapter() {
3124 mImeAdapter.reset();
3125 }
3126
3116 private float getWheelScrollFactorInPixels() { 3127 private float getWheelScrollFactorInPixels() {
3117 if (mWheelScrollFactorInPixels == 0) { 3128 if (mWheelScrollFactorInPixels == 0) {
3118 TypedValue outValue = new TypedValue(); 3129 TypedValue outValue = new TypedValue();
3119 // This is the same attribute used by Android Views to scale wheel 3130 // This is the same attribute used by Android Views to scale wheel
3120 // event motion into scroll deltas. 3131 // event motion into scroll deltas.
3121 if (mContext.getTheme().resolveAttribute( 3132 if (mContext.getTheme().resolveAttribute(
3122 android.R.attr.listPreferredItemHeight, outValue, true)) { 3133 android.R.attr.listPreferredItemHeight, outValue, true)) {
3123 mWheelScrollFactorInPixels = 3134 mWheelScrollFactorInPixels =
3124 outValue.getDimension(mContext.getResources().getDisplay Metrics()); 3135 outValue.getDimension(mContext.getResources().getDisplay Metrics());
3125 } else { 3136 } else {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
3291 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l, 3302 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l,
3292 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily, 3303 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily,
3293 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor, 3304 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor,
3294 String textTrackTextShadow, String textTrackTextSize); 3305 String textTrackTextShadow, String textTrackTextSize);
3295 3306
3296 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3307 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3297 int x, int y, int w, int h); 3308 int x, int y, int w, int h);
3298 3309
3299 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3310 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3300 } 3311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698