| 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.chrome.browser.omnibox; | 5 package org.chromium.chrome.browser.omnibox; |
| 6 | 6 |
| 7 import android.content.ClipData; | 7 import android.content.ClipData; |
| 8 import android.content.ClipboardManager; | 8 import android.content.ClipboardManager; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 import android.view.GestureDetector; | 23 import android.view.GestureDetector; |
| 24 import android.view.MotionEvent; | 24 import android.view.MotionEvent; |
| 25 import android.view.View; | 25 import android.view.View; |
| 26 import android.view.accessibility.AccessibilityEvent; | 26 import android.view.accessibility.AccessibilityEvent; |
| 27 import android.view.accessibility.AccessibilityManager; | 27 import android.view.accessibility.AccessibilityManager; |
| 28 import android.view.accessibility.AccessibilityNodeInfo; | 28 import android.view.accessibility.AccessibilityNodeInfo; |
| 29 import android.view.inputmethod.BaseInputConnection; | 29 import android.view.inputmethod.BaseInputConnection; |
| 30 import android.view.inputmethod.EditorInfo; | 30 import android.view.inputmethod.EditorInfo; |
| 31 import android.view.inputmethod.InputConnection; | 31 import android.view.inputmethod.InputConnection; |
| 32 import android.view.inputmethod.InputConnectionWrapper; | 32 import android.view.inputmethod.InputConnectionWrapper; |
| 33 import android.widget.TextView; |
| 33 | 34 |
| 34 import org.chromium.base.ApiCompatibilityUtils; | 35 import org.chromium.base.ApiCompatibilityUtils; |
| 35 import org.chromium.base.Log; | 36 import org.chromium.base.Log; |
| 36 import org.chromium.base.SysUtils; | 37 import org.chromium.base.SysUtils; |
| 37 import org.chromium.base.VisibleForTesting; | 38 import org.chromium.base.VisibleForTesting; |
| 38 import org.chromium.chrome.R; | 39 import org.chromium.chrome.R; |
| 39 import org.chromium.chrome.browser.metrics.StartupMetrics; | 40 import org.chromium.chrome.browser.metrics.StartupMetrics; |
| 40 import org.chromium.chrome.browser.omnibox.LocationBarLayout.OmniboxLivenessList
ener; | 41 import org.chromium.chrome.browser.omnibox.LocationBarLayout.OmniboxLivenessList
ener; |
| 41 import org.chromium.chrome.browser.tab.Tab; | 42 import org.chromium.chrome.browser.tab.Tab; |
| 42 import org.chromium.chrome.browser.util.UrlUtilities; | 43 import org.chromium.chrome.browser.util.UrlUtilities; |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 OmniboxUrlEmphasizer.deEmphasizeUrl(getText()); | 1154 OmniboxUrlEmphasizer.deEmphasizeUrl(getText()); |
| 1154 } | 1155 } |
| 1155 | 1156 |
| 1156 /** | 1157 /** |
| 1157 * @return Whether the current UrlBar input has been pasted from the clipboa
rd. | 1158 * @return Whether the current UrlBar input has been pasted from the clipboa
rd. |
| 1158 */ | 1159 */ |
| 1159 public boolean isPastedText() { | 1160 public boolean isPastedText() { |
| 1160 return mIsPastedText; | 1161 return mIsPastedText; |
| 1161 } | 1162 } |
| 1162 | 1163 |
| 1164 @Override |
| 1165 public CharSequence getAccessibilityClassName() { |
| 1166 // When UrlBar is used as a read-only TextView, force Talkback to pronou
nce it like |
| 1167 // TextView. Otherwise Talkback will say "Edit box, http://...". crbug.c
om/636988 |
| 1168 if (isEnabled()) { |
| 1169 return super.getAccessibilityClassName(); |
| 1170 } else { |
| 1171 return TextView.class.getName(); |
| 1172 } |
| 1173 } |
| 1174 |
| 1163 private void notifyAutocompleteTextStateChanged(boolean textDeleted) { | 1175 private void notifyAutocompleteTextStateChanged(boolean textDeleted) { |
| 1164 if (mUrlBarDelegate == null) return; | 1176 if (mUrlBarDelegate == null) return; |
| 1165 if (!hasFocus()) return; | 1177 if (!hasFocus()) return; |
| 1166 if (mIgnoreAutocomplete) return; | 1178 if (mIgnoreAutocomplete) return; |
| 1167 | 1179 |
| 1168 mLastUrlEditWasDelete = textDeleted; | 1180 mLastUrlEditWasDelete = textDeleted; |
| 1169 mUrlBarDelegate.onTextChangedForAutocomplete(textDeleted); | 1181 mUrlBarDelegate.onTextChangedForAutocomplete(textDeleted); |
| 1170 } | 1182 } |
| 1171 | 1183 |
| 1172 /** | 1184 /** |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 return (int) paint.measureText(ELLIPSIS); | 1228 return (int) paint.measureText(ELLIPSIS); |
| 1217 } | 1229 } |
| 1218 | 1230 |
| 1219 @Override | 1231 @Override |
| 1220 public void draw(Canvas canvas, CharSequence text, int start, int end, | 1232 public void draw(Canvas canvas, CharSequence text, int start, int end, |
| 1221 float x, int top, int y, int bottom, Paint paint) { | 1233 float x, int top, int y, int bottom, Paint paint) { |
| 1222 canvas.drawText(ELLIPSIS, x, y, paint); | 1234 canvas.drawText(ELLIPSIS, x, y, paint); |
| 1223 } | 1235 } |
| 1224 } | 1236 } |
| 1225 } | 1237 } |
| OLD | NEW |