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

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

Issue 713493003: Clear the selection when hiding the handles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a null check Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.app.Activity; 8 import android.app.Activity;
9 import android.app.SearchManager; 9 import android.app.SearchManager;
10 import android.content.ClipboardManager; 10 import android.content.ClipboardManager;
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 * @return A ContentSettings object that can be used to retrieve this 1308 * @return A ContentSettings object that can be used to retrieve this
1309 * ContentViewCore's settings. 1309 * ContentViewCore's settings.
1310 */ 1310 */
1311 public ContentSettings getContentSettings() { 1311 public ContentSettings getContentSettings() {
1312 return mContentSettings; 1312 return mContentSettings;
1313 } 1313 }
1314 1314
1315 private void hidePopupsAndClearSelection() { 1315 private void hidePopupsAndClearSelection() {
1316 mUnselectAllOnActionModeDismiss = true; 1316 mUnselectAllOnActionModeDismiss = true;
1317 hidePopups(); 1317 hidePopups();
1318 // Clear the selection. The selection is cleared on destroying IME
1319 // and also here since we may receive destroy first, for example
1320 // when focus is lost in webview.
1321 clearUserSelection();
1318 } 1322 }
1319 1323
1320 private void hidePopupsAndPreserveSelection() { 1324 private void hidePopupsAndPreserveSelection() {
1321 mUnselectAllOnActionModeDismiss = false; 1325 mUnselectAllOnActionModeDismiss = false;
1322 hidePopups(); 1326 hidePopups();
1323 } 1327 }
1324 1328
1329 private void clearUserSelection() {
1330 if (isSelectionEditable()) {
1331 if (mInputConnection != null) {
1332 int selectionEnd = Selection.getSelectionEnd(mEditable);
1333 mInputConnection.setSelection(selectionEnd, selectionEnd);
1334 }
1335 } else if (mImeAdapter != null) {
1336 mImeAdapter.unselect();
1337 }
1338 }
1339
1325 private void hidePopups() { 1340 private void hidePopups() {
1326 hideSelectActionBar(); 1341 hideSelectActionBar();
1327 hidePastePopup(); 1342 hidePastePopup();
1328 hideSelectPopup(); 1343 hideSelectPopup();
1329 mPopupZoomer.hide(false); 1344 mPopupZoomer.hide(false);
1330 if (mUnselectAllOnActionModeDismiss) hideTextHandles(); 1345 if (mUnselectAllOnActionModeDismiss) hideTextHandles();
1331 } 1346 }
1332 1347
1333 private void restoreSelectionPopupsIfNecessary() { 1348 private void restoreSelectionPopupsIfNecessary() {
1334 if (mHasSelection && mActionMode == null) showSelectActionBar(); 1349 if (mHasSelection && mActionMode == null) showSelectActionBar();
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 @Override 1935 @Override
1921 public boolean isSelectionEditable() { 1936 public boolean isSelectionEditable() {
1922 return mFocusedNodeEditable; 1937 return mFocusedNodeEditable;
1923 } 1938 }
1924 1939
1925 @Override 1940 @Override
1926 public void onDestroyActionMode() { 1941 public void onDestroyActionMode() {
1927 mActionMode = null; 1942 mActionMode = null;
1928 if (mUnselectAllOnActionModeDismiss) { 1943 if (mUnselectAllOnActionModeDismiss) {
1929 hideTextHandles(); 1944 hideTextHandles();
1930 if (isSelectionEditable()) { 1945 clearUserSelection();
1931 int selectionEnd = Selection.getSelectionEnd(mEditab le);
1932 mInputConnection.setSelection(selectionEnd, selectio nEnd);
1933 } else {
1934 mImeAdapter.unselect();
1935 }
1936 } 1946 }
1937 getContentViewClient().onContextualActionBarHidden(); 1947 getContentViewClient().onContextualActionBarHidden();
1938 } 1948 }
1939 1949
1940 @Override 1950 @Override
1941 public boolean isShareAvailable() { 1951 public boolean isShareAvailable() {
1942 Intent intent = new Intent(Intent.ACTION_SEND); 1952 Intent intent = new Intent(Intent.ACTION_SEND);
1943 intent.setType("text/plain"); 1953 intent.setType("text/plain");
1944 return getContext().getPackageManager().queryIntentActivitie s(intent, 1954 return getContext().getPackageManager().queryIntentActivitie s(intent,
1945 PackageManager.MATCH_DEFAULT_ONLY).size() > 0; 1955 PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
3027 private native void nativeWasResized(long nativeContentViewCoreImpl); 3037 private native void nativeWasResized(long nativeContentViewCoreImpl);
3028 3038
3029 private native void nativeSetAccessibilityEnabled( 3039 private native void nativeSetAccessibilityEnabled(
3030 long nativeContentViewCoreImpl, boolean enabled); 3040 long nativeContentViewCoreImpl, boolean enabled);
3031 3041
3032 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3042 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3033 int x, int y, int w, int h); 3043 int x, int y, int w, int h);
3034 3044
3035 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3045 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3036 } 3046 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698