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.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 2174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 } | 2185 } |
2186 | 2186 |
2187 /** | 2187 /** |
2188 * @return Whether the page has an active, touch-controlled selection region
. | 2188 * @return Whether the page has an active, touch-controlled selection region
. |
2189 */ | 2189 */ |
2190 @VisibleForTesting | 2190 @VisibleForTesting |
2191 public boolean hasSelection() { | 2191 public boolean hasSelection() { |
2192 return mHasSelection; | 2192 return mHasSelection; |
2193 } | 2193 } |
2194 | 2194 |
2195 /** | 2195 /** |
2196 * @return Whether the page has an active, touch-controlled insertion handle
. | 2196 * @return Whether the page has an active, touch-controlled insertion handle
. |
2197 */ | 2197 */ |
2198 @VisibleForTesting | 2198 @VisibleForTesting |
2199 protected boolean hasInsertion() { | 2199 public boolean hasInsertion() { |
2200 return mHasInsertion; | 2200 return mHasInsertion; |
2201 } | 2201 } |
2202 | 2202 |
2203 @CalledByNative | 2203 @CalledByNative |
2204 private void onSelectionEvent( | 2204 private void onSelectionEvent( |
2205 int eventType, int xAnchor, int yAnchor, int left, int top, int righ
t, int bottom) { | 2205 int eventType, int xAnchor, int yAnchor, int left, int top, int righ
t, int bottom) { |
2206 // Ensure the provided selection coordinates form a non-empty rect, as r
equired by | 2206 // Ensure the provided selection coordinates form a non-empty rect, as r
equired by |
2207 // the selection action mode. | 2207 // the selection action mode. |
2208 if (left == right) ++right; | 2208 if (left == right) ++right; |
2209 if (top == bottom) ++bottom; | 2209 if (top == bottom) ++bottom; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2276 | 2276 |
2277 default: | 2277 default: |
2278 assert false : "Invalid selection event type."; | 2278 assert false : "Invalid selection event type."; |
2279 } | 2279 } |
2280 if (mContextualSearchClient != null) { | 2280 if (mContextualSearchClient != null) { |
2281 mContextualSearchClient.onSelectionEvent(eventType, xAnchor, yAnchor
); | 2281 mContextualSearchClient.onSelectionEvent(eventType, xAnchor, yAnchor
); |
2282 } | 2282 } |
2283 } | 2283 } |
2284 | 2284 |
2285 private void dismissTextHandles() { | 2285 private void dismissTextHandles() { |
2286 mHasSelection = false; | |
2287 mHasInsertion = false; | |
2288 if (mNativeContentViewCore != 0) nativeDismissTextHandles(mNativeContent
ViewCore); | 2286 if (mNativeContentViewCore != 0) nativeDismissTextHandles(mNativeContent
ViewCore); |
2289 } | 2287 } |
2290 | 2288 |
2291 private void setTextHandlesTemporarilyHidden(boolean hide) { | 2289 private void setTextHandlesTemporarilyHidden(boolean hide) { |
2292 if (mNativeContentViewCore == 0) return; | 2290 if (mNativeContentViewCore == 0) return; |
2293 nativeSetTextHandlesTemporarilyHidden(mNativeContentViewCore, hide); | 2291 nativeSetTextHandlesTemporarilyHidden(mNativeContentViewCore, hide); |
2294 } | 2292 } |
2295 | 2293 |
2296 /** | 2294 /** |
2297 * Hides the IME if the containerView is the active view for IME. | 2295 * Hides the IME if the containerView is the active view for IME. |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3319 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp
l, | 3317 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp
l, |
3320 boolean textTracksEnabled, String textTrackBackgroundColor, String t
extTrackFontFamily, | 3318 boolean textTracksEnabled, String textTrackBackgroundColor, String t
extTrackFontFamily, |
3321 String textTrackFontStyle, String textTrackFontVariant, String textT
rackTextColor, | 3319 String textTrackFontStyle, String textTrackFontVariant, String textT
rackTextColor, |
3322 String textTrackTextShadow, String textTrackTextSize); | 3320 String textTrackTextShadow, String textTrackTextSize); |
3323 | 3321 |
3324 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3322 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
3325 int x, int y, int w, int h); | 3323 int x, int y, int w, int h); |
3326 | 3324 |
3327 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); | 3325 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); |
3328 } | 3326 } |
OLD | NEW |