OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.app.SearchManager; | 9 import android.app.SearchManager; |
10 import android.content.ClipData; | 10 import android.content.ClipData; |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
920 int eventType, int xAnchor, int yAnchor, int left, int top, int righ t, int bottom) { | 920 int eventType, int xAnchor, int yAnchor, int left, int top, int righ t, int bottom) { |
921 // Ensure the provided selection coordinates form a non-empty rect, as r equired by | 921 // Ensure the provided selection coordinates form a non-empty rect, as r equired by |
922 // the selection action mode. | 922 // the selection action mode. |
923 if (left == right) ++right; | 923 if (left == right) ++right; |
924 if (top == bottom) ++bottom; | 924 if (top == bottom) ++bottom; |
925 switch (eventType) { | 925 switch (eventType) { |
926 case SelectionEventType.SELECTION_HANDLES_SHOWN: | 926 case SelectionEventType.SELECTION_HANDLES_SHOWN: |
927 mSelectionRect.set(left, top, right, bottom); | 927 mSelectionRect.set(left, top, right, bottom); |
928 mHasSelection = true; | 928 mHasSelection = true; |
929 mUnselectAllOnDismiss = true; | 929 mUnselectAllOnDismiss = true; |
930 if (mSelectionClient == null || !mSelectionClient.sendsSelection PopupUpdates()) { | 930 if (mSelectionClient == null |
Tima Vaisburd
2017/05/05 01:57:06
Nice, I think another option to think of would be
boliu
2017/05/05 02:11:50
true /* suggest */ is good enough for me. I mean d
Tima Vaisburd
2017/05/05 16:54:41
It is absolutely unrelated to this particular CL b
amaralp
2017/05/05 21:18:31
Do you know if Android has already implemented the
| |
931 || !mSelectionClient.requestSelectionPopupUpdates(true)) { | |
931 showActionModeOrClearOnFailure(); | 932 showActionModeOrClearOnFailure(); |
932 } else { | 933 } else { |
933 // Rely on |mSelectionClient| sending a classification reque st and the request | 934 // Rely on |mSelectionClient| sending a classification reque st and the request |
934 // always calling onClassified() callback. | 935 // always calling onClassified() callback. |
935 mPendingShowActionMode = true; | 936 mPendingShowActionMode = true; |
936 } | 937 } |
937 break; | 938 break; |
938 | 939 |
939 case SelectionEventType.SELECTION_HANDLES_MOVED: | 940 case SelectionEventType.SELECTION_HANDLES_MOVED: |
940 mSelectionRect.set(left, top, right, bottom); | 941 mSelectionRect.set(left, top, right, bottom); |
941 if (mPendingShowActionMode) { | 942 if (mPendingShowActionMode) { |
942 showActionModeOrClearOnFailure(); | 943 showActionModeOrClearOnFailure(); |
943 } else { | 944 } else { |
944 invalidateContentRect(); | 945 invalidateContentRect(); |
945 } | 946 } |
946 break; | 947 break; |
947 | 948 |
948 case SelectionEventType.SELECTION_HANDLES_CLEARED: | 949 case SelectionEventType.SELECTION_HANDLES_CLEARED: |
949 mHasSelection = false; | 950 mHasSelection = false; |
950 mUnselectAllOnDismiss = false; | 951 mUnselectAllOnDismiss = false; |
951 mSelectionRect.setEmpty(); | 952 mSelectionRect.setEmpty(); |
953 if (mSelectionClient != null) mSelectionClient.cancelAllRequests (); | |
952 finishActionMode(); | 954 finishActionMode(); |
953 break; | 955 break; |
954 | 956 |
955 case SelectionEventType.SELECTION_HANDLE_DRAG_STARTED: | 957 case SelectionEventType.SELECTION_HANDLE_DRAG_STARTED: |
956 hideActionMode(true); | 958 hideActionMode(true); |
957 break; | 959 break; |
958 | 960 |
959 case SelectionEventType.SELECTION_HANDLE_DRAG_STOPPED: | 961 case SelectionEventType.SELECTION_HANDLE_DRAG_STOPPED: |
960 if (mSelectionClient == null || !mSelectionClient.sendsSelection PopupUpdates()) { | 962 if (mSelectionClient == null |
963 || !mSelectionClient.requestSelectionPopupUpdates(false) ) { | |
961 hideActionMode(false); | 964 hideActionMode(false); |
962 } | 965 } |
963 // Otherwise rely on |mSelectionClient| sending a classification request and the | 966 // Otherwise rely on |mSelectionClient| sending a classification request and the |
964 // request always calling onClassified() callback. | 967 // request always calling onClassified() callback. |
965 break; | 968 break; |
966 | 969 |
967 case SelectionEventType.INSERTION_HANDLE_SHOWN: | 970 case SelectionEventType.INSERTION_HANDLE_SHOWN: |
968 mSelectionRect.set(left, top, right, bottom); | 971 mSelectionRect.set(left, top, right, bottom); |
969 mIsInsertion = true; | 972 mIsInsertion = true; |
970 break; | 973 break; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1134 if (mPendingShowActionMode) return; | 1137 if (mPendingShowActionMode) return; |
1135 } | 1138 } |
1136 | 1139 |
1137 // Rely on this method to clear |mHidden| and unhide the action mode . | 1140 // Rely on this method to clear |mHidden| and unhide the action mode . |
1138 showActionModeOrClearOnFailure(); | 1141 showActionModeOrClearOnFailure(); |
1139 } | 1142 } |
1140 }; | 1143 }; |
1141 | 1144 |
1142 private native void nativeInit(WebContents webContents); | 1145 private native void nativeInit(WebContents webContents); |
1143 } | 1146 } |
OLD | NEW |