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

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

Issue 1209243003: Changed the constraints for hiding the top controls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Used pollForUIThreadCriteria instead of pollForCriteria in the test code Created 5 years, 5 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 return new ImeAdapter(mInputMethodManagerWrapper, 735 return new ImeAdapter(mInputMethodManagerWrapper,
736 new ImeAdapter.ImeAdapterDelegate() { 736 new ImeAdapter.ImeAdapterDelegate() {
737 @Override 737 @Override
738 public void onImeEvent() { 738 public void onImeEvent() {
739 mPopupZoomer.hide(true); 739 mPopupZoomer.hide(true);
740 getContentViewClient().onImeEvent(); 740 getContentViewClient().onImeEvent();
741 if (mFocusedNodeEditable) dismissTextHandles(); 741 if (mFocusedNodeEditable) dismissTextHandles();
742 } 742 }
743 743
744 @Override 744 @Override
745 public void onDismissInput() {
746 getContentViewClient().onImeStateChangeRequested(false);
747 }
748
749 @Override
750 public void onKeyboardBoundsUnchanged() { 745 public void onKeyboardBoundsUnchanged() {
751 assert mWebContents != null; 746 assert mWebContents != null;
752 mWebContents.scrollFocusedEditableNodeIntoView(); 747 mWebContents.scrollFocusedEditableNodeIntoView();
753 } 748 }
754 749
755 @Override 750 @Override
756 public boolean performContextMenuAction(int id) { 751 public boolean performContextMenuAction(int id) {
757 assert mWebContents != null; 752 assert mWebContents != null;
758 switch (id) { 753 switch (id) {
759 case android.R.id.selectAll: 754 case android.R.id.selectAll:
(...skipping 16 matching lines...) Expand all
776 @Override 771 @Override
777 public View getAttachedView() { 772 public View getAttachedView() {
778 return mContainerView; 773 return mContainerView;
779 } 774 }
780 775
781 @Override 776 @Override
782 public ResultReceiver getNewShowKeyboardReceiver() { 777 public ResultReceiver getNewShowKeyboardReceiver() {
783 return new ResultReceiver(new Handler()) { 778 return new ResultReceiver(new Handler()) {
784 @Override 779 @Override
785 public void onReceiveResult(int resultCode, Bundle r esultData) { 780 public void onReceiveResult(int resultCode, Bundle r esultData) {
786 getContentViewClient().onImeStateChangeRequested (
787 resultCode == InputMethodManager.RESULT_ SHOWN
788 || resultCode == InputMethodManager.RESU LT_UNCHANGED_SHOWN);
789 if (resultCode == InputMethodManager.RESULT_SHOW N) { 781 if (resultCode == InputMethodManager.RESULT_SHOW N) {
790 // If OSK is newly shown, delay the form foc us until 782 // If OSK is newly shown, delay the form foc us until
791 // the onSizeChanged (in order to adjust rel ative to the 783 // the onSizeChanged (in order to adjust rel ative to the
792 // new size). 784 // new size).
793 // TODO(jdduke): We should not assume that o nSizeChanged will 785 // TODO(jdduke): We should not assume that o nSizeChanged will
794 // always be called, crbug.com/294908. 786 // always be called, crbug.com/294908.
795 getContainerView().getWindowVisibleDisplayFr ame( 787 getContainerView().getWindowVisibleDisplayFr ame(
796 mFocusPreOSKViewportRect); 788 mFocusPreOSKViewportRect);
797 } else if (hasFocus() && resultCode 789 } else if (hasFocus() && resultCode
798 == InputMethodManager.RESULT_UNCHANGED_S HOWN) { 790 == InputMethodManager.RESULT_UNCHANGED_S HOWN) {
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 } 2281 }
2290 2282
2291 /** 2283 /**
2292 * Hides the IME if the containerView is the active view for IME. 2284 * Hides the IME if the containerView is the active view for IME.
2293 */ 2285 */
2294 public void hideImeIfNeeded() { 2286 public void hideImeIfNeeded() {
2295 // Hide input method window from the current view synchronously 2287 // Hide input method window from the current view synchronously
2296 // because ImeAdapter does so asynchronouly with a delay, and 2288 // because ImeAdapter does so asynchronouly with a delay, and
2297 // by the time when ImeAdapter dismisses the input, the 2289 // by the time when ImeAdapter dismisses the input, the
2298 // containerView may have lost focus. 2290 // containerView may have lost focus.
2299 // We cannot trust ContentViewClient#onImeStateChangeRequested to
2300 // hide the input window because it has an empty default implementation.
2301 // So we need to explicitly hide the input method window here.
2302 if (mInputMethodManagerWrapper.isActive(mContainerView)) { 2291 if (mInputMethodManagerWrapper.isActive(mContainerView)) {
2303 mInputMethodManagerWrapper.hideSoftInputFromWindow( 2292 mInputMethodManagerWrapper.hideSoftInputFromWindow(
2304 mContainerView.getWindowToken(), 0, null); 2293 mContainerView.getWindowToken(), 0, null);
2305 } 2294 }
2306 getContentViewClient().onImeStateChangeRequested(false);
2307 } 2295 }
2308 2296
2309 @SuppressWarnings("unused") 2297 @SuppressWarnings("unused")
2310 @CalledByNative 2298 @CalledByNative
2311 private void updateFrameInfo( 2299 private void updateFrameInfo(
2312 float scrollOffsetX, float scrollOffsetY, 2300 float scrollOffsetX, float scrollOffsetY,
2313 float pageScaleFactor, float minPageScaleFactor, float maxPageScaleF actor, 2301 float pageScaleFactor, float minPageScaleFactor, float maxPageScaleF actor,
2314 float contentWidth, float contentHeight, 2302 float contentWidth, float contentHeight,
2315 float viewportWidth, float viewportHeight, 2303 float viewportWidth, float viewportHeight,
2316 float controlsOffsetYCss, float contentOffsetYCss, 2304 float controlsOffsetYCss, float contentOffsetYCss,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 TraceEvent.end("ContentViewCore:updateFrameInfo"); 2372 TraceEvent.end("ContentViewCore:updateFrameInfo");
2385 } 2373 }
2386 2374
2387 @CalledByNative 2375 @CalledByNative
2388 private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputTyp e, 2376 private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputTyp e,
2389 int textInputFlags, String text, int selectionStart, int selectionEn d, 2377 int textInputFlags, String text, int selectionStart, int selectionEn d,
2390 int compositionStart, int compositionEnd, boolean showImeIfNeeded, 2378 int compositionStart, int compositionEnd, boolean showImeIfNeeded,
2391 boolean isNonImeChange) { 2379 boolean isNonImeChange) {
2392 try { 2380 try {
2393 TraceEvent.begin("ContentViewCore.updateImeAdapter"); 2381 TraceEvent.begin("ContentViewCore.updateImeAdapter");
2394 mFocusedNodeEditable = (textInputType != TextInputType.NONE); 2382 boolean focusedNodeEditable = (textInputType != TextInputType.NONE);
2395 if (!mFocusedNodeEditable) hidePastePopup(); 2383 if (!focusedNodeEditable) hidePastePopup();
2396 2384
2397 mImeAdapter.updateKeyboardVisibility( 2385 mImeAdapter.updateKeyboardVisibility(
2398 nativeImeAdapterAndroid, textInputType, textInputFlags, show ImeIfNeeded); 2386 nativeImeAdapterAndroid, textInputType, textInputFlags, show ImeIfNeeded);
2399 2387
2400 if (mInputConnection != null) { 2388 if (mInputConnection != null) {
2401 mInputConnection.updateState(text, selectionStart, selectionEnd, compositionStart, 2389 mInputConnection.updateState(text, selectionStart, selectionEnd, compositionStart,
2402 compositionEnd, isNonImeChange); 2390 compositionEnd, isNonImeChange);
2403 } 2391 }
2404 2392
2405 if (mActionMode != null) mActionMode.invalidate(); 2393 if (mActionMode != null) mActionMode.invalidate();
2394
2395 if (focusedNodeEditable != mFocusedNodeEditable) {
2396 mFocusedNodeEditable = focusedNodeEditable;
2397 getContentViewClient().onFocusedNodeEditabilityChanged(mFocusedN odeEditable);
2398 }
2406 } finally { 2399 } finally {
2407 TraceEvent.end("ContentViewCore.updateImeAdapter"); 2400 TraceEvent.end("ContentViewCore.updateImeAdapter");
2408 } 2401 }
2409 } 2402 }
2410 2403
2411 @CalledByNative 2404 @CalledByNative
2412 private void forceUpdateImeAdapter(long nativeImeAdapterAndroid) { 2405 private void forceUpdateImeAdapter(long nativeImeAdapterAndroid) {
2413 mImeAdapter.attach(nativeImeAdapterAndroid); 2406 mImeAdapter.attach(nativeImeAdapterAndroid);
2414 } 2407 }
2415 2408
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 String textTrackFontVariant, String textTrackTextColor, String textT rackTextShadow, 3238 String textTrackFontVariant, String textTrackTextColor, String textT rackTextShadow,
3246 String textTrackTextSize); 3239 String textTrackTextSize);
3247 3240
3248 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3241 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3249 int x, int y, int w, int h); 3242 int x, int y, int w, int h);
3250 3243
3251 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3244 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3252 3245
3253 private native void nativeSetDrawsContent(long nativeContentViewCoreImpl, bo olean draws); 3246 private native void nativeSetDrawsContent(long nativeContentViewCoreImpl, bo olean draws);
3254 } 3247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698