OLD | NEW |
---|---|
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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1320 // when focus is lost in webview. | 1320 // when focus is lost in webview. |
1321 clearUserSelection(); | 1321 clearUserSelection(); |
1322 } | 1322 } |
1323 | 1323 |
1324 private void hidePopupsAndPreserveSelection() { | 1324 private void hidePopupsAndPreserveSelection() { |
1325 mUnselectAllOnActionModeDismiss = false; | 1325 mUnselectAllOnActionModeDismiss = false; |
1326 hidePopups(); | 1326 hidePopups(); |
1327 } | 1327 } |
1328 | 1328 |
1329 private void clearUserSelection() { | 1329 private void clearUserSelection() { |
1330 if (isSelectionEditable()) { | 1330 if (isSelectionEditable()) { |
jdduke (slow)
2014/11/24 21:14:20
Actually, can we just change this to be |if (mFocu
hush (inactive)
2014/11/24 23:23:56
I tried it and it worked.
jdduke (slow)
2014/11/24 23:28:11
Thanks, let's go with that instead if we can.
| |
1331 if (mInputConnection != null) { | 1331 if (mInputConnection != null) { |
1332 int selectionEnd = Selection.getSelectionEnd(mEditable); | 1332 int selectionEnd = Selection.getSelectionEnd(mEditable); |
1333 mInputConnection.setSelection(selectionEnd, selectionEnd); | 1333 mInputConnection.setSelection(selectionEnd, selectionEnd); |
1334 } | 1334 } |
1335 } else if (mImeAdapter != null) { | 1335 } else if (mImeAdapter != null) { |
1336 mImeAdapter.unselect(); | 1336 mImeAdapter.unselect(); |
1337 } | 1337 } |
1338 } | 1338 } |
1339 | 1339 |
1340 private void hidePopups() { | 1340 private void hidePopups() { |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1946 | 1946 |
1947 @Override | 1947 @Override |
1948 public boolean isSelectionEditable() { | 1948 public boolean isSelectionEditable() { |
1949 return mFocusedNodeEditable; | 1949 return mFocusedNodeEditable; |
1950 } | 1950 } |
1951 | 1951 |
1952 @Override | 1952 @Override |
1953 public void onDestroyActionMode() { | 1953 public void onDestroyActionMode() { |
1954 mActionMode = null; | 1954 mActionMode = null; |
1955 if (mUnselectAllOnActionModeDismiss) { | 1955 if (mUnselectAllOnActionModeDismiss) { |
1956 boolean isEditable = isSelectionEditable(); | |
1956 dismissTextHandles(); | 1957 dismissTextHandles(); |
1957 clearUserSelection(); | 1958 if (isEditable) { |
1959 if (mInputConnection != null) { | |
1960 int selectionEnd = Selection.getSelectionEnd(mEd itable); | |
1961 mInputConnection.setSelection(selectionEnd, sele ctionEnd); | |
1962 } else if (mImeAdapter != null) { | |
1963 mImeAdapter.unselect(); | |
1964 } | |
1965 } | |
1958 } | 1966 } |
1959 getContentViewClient().onContextualActionBarHidden(); | 1967 getContentViewClient().onContextualActionBarHidden(); |
1960 } | 1968 } |
1961 | 1969 |
1962 @Override | 1970 @Override |
1963 public boolean isShareAvailable() { | 1971 public boolean isShareAvailable() { |
1964 Intent intent = new Intent(Intent.ACTION_SEND); | 1972 Intent intent = new Intent(Intent.ACTION_SEND); |
1965 intent.setType("text/plain"); | 1973 intent.setType("text/plain"); |
1966 return getContext().getPackageManager().queryIntentActivitie s(intent, | 1974 return getContext().getPackageManager().queryIntentActivitie s(intent, |
1967 PackageManager.MATCH_DEFAULT_ONLY).size() > 0; | 1975 PackageManager.MATCH_DEFAULT_ONLY).size() > 0; |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3056 private native void nativeWasResized(long nativeContentViewCoreImpl); | 3064 private native void nativeWasResized(long nativeContentViewCoreImpl); |
3057 | 3065 |
3058 private native void nativeSetAccessibilityEnabled( | 3066 private native void nativeSetAccessibilityEnabled( |
3059 long nativeContentViewCoreImpl, boolean enabled); | 3067 long nativeContentViewCoreImpl, boolean enabled); |
3060 | 3068 |
3061 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, | 3069 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, |
3062 int x, int y, int w, int h); | 3070 int x, int y, int w, int h); |
3063 | 3071 |
3064 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); | 3072 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); |
3065 } | 3073 } |
OLD | NEW |