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

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: Changed the client callback to update Editability of the focused node 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() { 745 public void onDismissInput() {
jdduke (slow) 2015/07/01 16:02:04 Can we then get rid of this delegate method entire
raghu 2015/07/01 17:16:57 Acknowledged.
746 getContentViewClient().onImeStateChangeRequested(false);
747 } 746 }
748 747
749 @Override 748 @Override
750 public void onKeyboardBoundsUnchanged() { 749 public void onKeyboardBoundsUnchanged() {
751 assert mWebContents != null; 750 assert mWebContents != null;
752 mWebContents.scrollFocusedEditableNodeIntoView(); 751 mWebContents.scrollFocusedEditableNodeIntoView();
753 } 752 }
754 753
755 @Override 754 @Override
756 public boolean performContextMenuAction(int id) { 755 public boolean performContextMenuAction(int id) {
(...skipping 19 matching lines...) Expand all
776 @Override 775 @Override
777 public View getAttachedView() { 776 public View getAttachedView() {
778 return mContainerView; 777 return mContainerView;
779 } 778 }
780 779
781 @Override 780 @Override
782 public ResultReceiver getNewShowKeyboardReceiver() { 781 public ResultReceiver getNewShowKeyboardReceiver() {
783 return new ResultReceiver(new Handler()) { 782 return new ResultReceiver(new Handler()) {
784 @Override 783 @Override
785 public void onReceiveResult(int resultCode, Bundle r esultData) { 784 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) { 785 if (resultCode == InputMethodManager.RESULT_SHOW N) {
790 // If OSK is newly shown, delay the form foc us until 786 // If OSK is newly shown, delay the form foc us until
791 // the onSizeChanged (in order to adjust rel ative to the 787 // the onSizeChanged (in order to adjust rel ative to the
792 // new size). 788 // new size).
793 // TODO(jdduke): We should not assume that o nSizeChanged will 789 // TODO(jdduke): We should not assume that o nSizeChanged will
794 // always be called, crbug.com/294908. 790 // always be called, crbug.com/294908.
795 getContainerView().getWindowVisibleDisplayFr ame( 791 getContainerView().getWindowVisibleDisplayFr ame(
796 mFocusPreOSKViewportRect); 792 mFocusPreOSKViewportRect);
797 } else if (hasFocus() && resultCode 793 } else if (hasFocus() && resultCode
798 == InputMethodManager.RESULT_UNCHANGED_S HOWN) { 794 == InputMethodManager.RESULT_UNCHANGED_S HOWN) {
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 } 2285 }
2290 2286
2291 /** 2287 /**
2292 * Hides the IME if the containerView is the active view for IME. 2288 * Hides the IME if the containerView is the active view for IME.
2293 */ 2289 */
2294 public void hideImeIfNeeded() { 2290 public void hideImeIfNeeded() {
2295 // Hide input method window from the current view synchronously 2291 // Hide input method window from the current view synchronously
2296 // because ImeAdapter does so asynchronouly with a delay, and 2292 // because ImeAdapter does so asynchronouly with a delay, and
2297 // by the time when ImeAdapter dismisses the input, the 2293 // by the time when ImeAdapter dismisses the input, the
2298 // containerView may have lost focus. 2294 // 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)) { 2295 if (mInputMethodManagerWrapper.isActive(mContainerView)) {
2303 mInputMethodManagerWrapper.hideSoftInputFromWindow( 2296 mInputMethodManagerWrapper.hideSoftInputFromWindow(
2304 mContainerView.getWindowToken(), 0, null); 2297 mContainerView.getWindowToken(), 0, null);
2305 } 2298 }
2306 getContentViewClient().onImeStateChangeRequested(false);
2307 } 2299 }
2308 2300
2309 @SuppressWarnings("unused") 2301 @SuppressWarnings("unused")
2310 @CalledByNative 2302 @CalledByNative
2311 private void updateFrameInfo( 2303 private void updateFrameInfo(
2312 float scrollOffsetX, float scrollOffsetY, 2304 float scrollOffsetX, float scrollOffsetY,
2313 float pageScaleFactor, float minPageScaleFactor, float maxPageScaleF actor, 2305 float pageScaleFactor, float minPageScaleFactor, float maxPageScaleF actor,
2314 float contentWidth, float contentHeight, 2306 float contentWidth, float contentHeight,
2315 float viewportWidth, float viewportHeight, 2307 float viewportWidth, float viewportHeight,
2316 float controlsOffsetYCss, float contentOffsetYCss, 2308 float controlsOffsetYCss, float contentOffsetYCss,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 TraceEvent.end("ContentViewCore:updateFrameInfo"); 2376 TraceEvent.end("ContentViewCore:updateFrameInfo");
2385 } 2377 }
2386 2378
2387 @CalledByNative 2379 @CalledByNative
2388 private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputTyp e, 2380 private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputTyp e,
2389 int textInputFlags, String text, int selectionStart, int selectionEn d, 2381 int textInputFlags, String text, int selectionStart, int selectionEn d,
2390 int compositionStart, int compositionEnd, boolean showImeIfNeeded, 2382 int compositionStart, int compositionEnd, boolean showImeIfNeeded,
2391 boolean isNonImeChange) { 2383 boolean isNonImeChange) {
2392 try { 2384 try {
2393 TraceEvent.begin("ContentViewCore.updateImeAdapter"); 2385 TraceEvent.begin("ContentViewCore.updateImeAdapter");
2394 mFocusedNodeEditable = (textInputType != TextInputType.NONE); 2386 boolean focusedNodeEditable = (textInputType != TextInputType.NONE);
2395 if (!mFocusedNodeEditable) hidePastePopup(); 2387 if (!focusedNodeEditable) hidePastePopup();
2396 2388
2397 mImeAdapter.updateKeyboardVisibility( 2389 mImeAdapter.updateKeyboardVisibility(
2398 nativeImeAdapterAndroid, textInputType, textInputFlags, show ImeIfNeeded); 2390 nativeImeAdapterAndroid, textInputType, textInputFlags, show ImeIfNeeded);
2399 2391
2400 if (mInputConnection != null) { 2392 if (mInputConnection != null) {
2401 mInputConnection.updateState(text, selectionStart, selectionEnd, compositionStart, 2393 mInputConnection.updateState(text, selectionStart, selectionEnd, compositionStart,
2402 compositionEnd, isNonImeChange); 2394 compositionEnd, isNonImeChange);
2403 } 2395 }
2404 2396
2405 if (mActionMode != null) mActionMode.invalidate(); 2397 if (mActionMode != null) mActionMode.invalidate();
2398
2399 if (focusedNodeEditable != mFocusedNodeEditable) {
2400 mFocusedNodeEditable = focusedNodeEditable;
2401 getContentViewClient().onFocusedNodeEditabilityChanged(mFocusedN odeEditable);
2402 }
2406 } finally { 2403 } finally {
2407 TraceEvent.end("ContentViewCore.updateImeAdapter"); 2404 TraceEvent.end("ContentViewCore.updateImeAdapter");
2408 } 2405 }
2409 } 2406 }
2410 2407
2411 @CalledByNative 2408 @CalledByNative
2412 private void forceUpdateImeAdapter(long nativeImeAdapterAndroid) { 2409 private void forceUpdateImeAdapter(long nativeImeAdapterAndroid) {
2413 mImeAdapter.attach(nativeImeAdapterAndroid); 2410 mImeAdapter.attach(nativeImeAdapterAndroid);
2414 } 2411 }
2415 2412
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 String textTrackFontVariant, String textTrackTextColor, String textT rackTextShadow, 3242 String textTrackFontVariant, String textTrackTextColor, String textT rackTextShadow,
3246 String textTrackTextSize); 3243 String textTrackTextSize);
3247 3244
3248 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3245 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3249 int x, int y, int w, int h); 3246 int x, int y, int w, int h);
3250 3247
3251 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3248 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3252 3249
3253 private native void nativeSetDrawsContent(long nativeContentViewCoreImpl, bo olean draws); 3250 private native void nativeSetDrawsContent(long nativeContentViewCoreImpl, bo olean draws);
3254 } 3251 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698