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

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: adding missing ImeTestUtils.java 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();
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 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after
3102 public void setSmartClipDataListener(SmartClipDataListener listener) { 3104 public void setSmartClipDataListener(SmartClipDataListener listener) {
3103 mSmartClipDataListener = listener; 3105 mSmartClipDataListener = listener;
3104 } 3106 }
3105 3107
3106 public void setBackgroundOpaque(boolean opaque) { 3108 public void setBackgroundOpaque(boolean opaque) {
3107 if (mNativeContentViewCore != 0) { 3109 if (mNativeContentViewCore != 0) {
3108 nativeSetBackgroundOpaque(mNativeContentViewCore, opaque); 3110 nativeSetBackgroundOpaque(mNativeContentViewCore, opaque);
3109 } 3111 }
3110 } 3112 }
3111 3113
3114 @VisibleForTesting
3115 public WebContentsObserver getWebContentsObserverForTest() {
3116 return mWebContentsObserver;
Ted C 2016/02/17 19:09:33 Instead of exposing this, can you use the list fro
Changwan Ryu 2016/02/18 06:03:26 Done.
3117 }
3118
3112 /** 3119 /**
3113 * Offer a long press gesture to the embedding View, primarily for WebView c ompatibility. 3120 * Offer a long press gesture to the embedding View, primarily for WebView c ompatibility.
3114 * 3121 *
3115 * @return true if the embedder handled the event. 3122 * @return true if the embedder handled the event.
3116 */ 3123 */
3117 private boolean offerLongPressToEmbedder() { 3124 private boolean offerLongPressToEmbedder() {
3118 return mContainerView.performLongClick(); 3125 return mContainerView.performLongClick();
3119 } 3126 }
3120 3127
3121 /** 3128 /**
3122 * Reset scroll and fling accounting, notifying listeners as appropriate. 3129 * Reset scroll and fling accounting, notifying listeners as appropriate.
3123 * This is useful as a failsafe when the input stream may have been interrup ed. 3130 * This is useful as a failsafe when the input stream may have been interrup ed.
3124 */ 3131 */
3125 private void resetScrollInProgress() { 3132 private void resetScrollInProgress() {
3126 if (!isScrollInProgress()) return; 3133 if (!isScrollInProgress()) return;
3127 3134
3128 final boolean touchScrollInProgress = mTouchScrollInProgress; 3135 final boolean touchScrollInProgress = mTouchScrollInProgress;
3129 final int potentiallyActiveFlingCount = mPotentiallyActiveFlingCount; 3136 final int potentiallyActiveFlingCount = mPotentiallyActiveFlingCount;
3130 3137
3131 setTouchScrollInProgress(false); 3138 setTouchScrollInProgress(false);
3132 mPotentiallyActiveFlingCount = 0; 3139 mPotentiallyActiveFlingCount = 0;
3133 if (touchScrollInProgress) updateGestureStateListener(GestureEventType.S CROLL_END); 3140 if (touchScrollInProgress) updateGestureStateListener(GestureEventType.S CROLL_END);
3134 if (potentiallyActiveFlingCount > 0) updateGestureStateListener(GestureE ventType.FLING_END); 3141 if (potentiallyActiveFlingCount > 0) updateGestureStateListener(GestureE ventType.FLING_END);
3135 } 3142 }
3136 3143
3144 private void resetImeAdapter() {
3145 mImeAdapter.reset();
3146 }
3147
3137 private float getWheelScrollFactorInPixels() { 3148 private float getWheelScrollFactorInPixels() {
3138 if (mWheelScrollFactorInPixels == 0) { 3149 if (mWheelScrollFactorInPixels == 0) {
3139 TypedValue outValue = new TypedValue(); 3150 TypedValue outValue = new TypedValue();
3140 // This is the same attribute used by Android Views to scale wheel 3151 // This is the same attribute used by Android Views to scale wheel
3141 // event motion into scroll deltas. 3152 // event motion into scroll deltas.
3142 if (mContext.getTheme().resolveAttribute( 3153 if (mContext.getTheme().resolveAttribute(
3143 android.R.attr.listPreferredItemHeight, outValue, true)) { 3154 android.R.attr.listPreferredItemHeight, outValue, true)) {
3144 mWheelScrollFactorInPixels = 3155 mWheelScrollFactorInPixels =
3145 outValue.getDimension(mContext.getResources().getDisplay Metrics()); 3156 outValue.getDimension(mContext.getResources().getDisplay Metrics());
3146 } else { 3157 } else {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l, 3321 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l,
3311 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily, 3322 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily,
3312 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor, 3323 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor,
3313 String textTrackTextShadow, String textTrackTextSize); 3324 String textTrackTextShadow, String textTrackTextSize);
3314 3325
3315 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3326 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3316 int x, int y, int w, int h); 3327 int x, int y, int w, int h);
3317 3328
3318 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3329 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3319 } 3330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698