| 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 static org.chromium.chrome.browser.toolbar.ToolbarPhone.URL_FOCUS_CHANGE_
ANIMATION_DURATION_MS; | 7 import static org.chromium.chrome.browser.toolbar.ToolbarPhone.URL_FOCUS_CHANGE_
ANIMATION_DURATION_MS; |
| 8 | 8 |
| 9 import android.Manifest; | 9 import android.Manifest; |
| 10 import android.animation.Animator; | 10 import android.animation.Animator; |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 @IntDef({BUTTON_TYPE_NONE, BUTTON_TYPE_SECURITY_ICON, BUTTON_TYPE_NAVIGATION
_ICON}) | 400 @IntDef({BUTTON_TYPE_NONE, BUTTON_TYPE_SECURITY_ICON, BUTTON_TYPE_NAVIGATION
_ICON}) |
| 401 public @interface LocationBarButtonType {} | 401 public @interface LocationBarButtonType {} |
| 402 /** No button should be shown. */ | 402 /** No button should be shown. */ |
| 403 public static final int BUTTON_TYPE_NONE = 0; | 403 public static final int BUTTON_TYPE_NONE = 0; |
| 404 /** Security button should be shown (includes offline icon). */ | 404 /** Security button should be shown (includes offline icon). */ |
| 405 public static final int BUTTON_TYPE_SECURITY_ICON = 1; | 405 public static final int BUTTON_TYPE_SECURITY_ICON = 1; |
| 406 /** Navigation button should be shown. */ | 406 /** Navigation button should be shown. */ |
| 407 public static final int BUTTON_TYPE_NAVIGATION_ICON = 2; | 407 public static final int BUTTON_TYPE_NAVIGATION_ICON = 2; |
| 408 | 408 |
| 409 /** | 409 /** |
| 410 * @param outRect Populated with a {@link Rect} that represents the {@link T
ab} specific content | |
| 411 * of this {@link LocationBar}. | |
| 412 */ | |
| 413 public void getContentRect(Rect outRect) { | |
| 414 outRect.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRi
ght(), | |
| 415 getHeight() - getPaddingBottom()); | |
| 416 } | |
| 417 | |
| 418 /** | |
| 419 * A widget for showing a list of omnibox suggestions. | 410 * A widget for showing a list of omnibox suggestions. |
| 420 */ | 411 */ |
| 421 @VisibleForTesting | 412 @VisibleForTesting |
| 422 public class OmniboxSuggestionsList extends ListView { | 413 public class OmniboxSuggestionsList extends ListView { |
| 423 private final int mSuggestionHeight; | 414 private final int mSuggestionHeight; |
| 424 private final int mSuggestionAnswerHeight; | 415 private final int mSuggestionAnswerHeight; |
| 425 private final View mAnchorView; | 416 private final View mAnchorView; |
| 426 | 417 |
| 427 private final int[] mTempPosition = new int[2]; | 418 private final int[] mTempPosition = new int[2]; |
| 428 private final Rect mTempRect = new Rect(); | 419 private final Rect mTempRect = new Rect(); |
| (...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2307 @Override | 2298 @Override |
| 2308 public void updateMicButtonState() { | 2299 public void updateMicButtonState() { |
| 2309 mVoiceSearchEnabled = isVoiceSearchEnabled(); | 2300 mVoiceSearchEnabled = isVoiceSearchEnabled(); |
| 2310 updateButtonVisibility(); | 2301 updateButtonVisibility(); |
| 2311 } | 2302 } |
| 2312 | 2303 |
| 2313 /** | 2304 /** |
| 2314 * Updates the display of the mic button. | 2305 * Updates the display of the mic button. |
| 2315 * @param urlFocusChangePercent The completeion percentage of the URL focus
change animation. | 2306 * @param urlFocusChangePercent The completeion percentage of the URL focus
change animation. |
| 2316 */ | 2307 */ |
| 2317 protected void updateMicButtonVisiblity(float urlFocusChangePercent) { | 2308 protected void updateMicButtonVisibility(float urlFocusChangePercent) { |
| 2318 boolean visible = !shouldShowDeleteButton(); | 2309 boolean visible = !shouldShowDeleteButton(); |
| 2319 boolean showMicButton = mVoiceSearchEnabled && visible | 2310 boolean showMicButton = mVoiceSearchEnabled && visible |
| 2320 && (mUrlBar.hasFocus() || mUrlFocusChangeInProgress | 2311 && (mUrlBar.hasFocus() || mUrlFocusChangeInProgress |
| 2321 || urlFocusChangePercent > 0f); | 2312 || urlFocusChangePercent > 0f); |
| 2322 mMicButton.setVisibility(showMicButton ? VISIBLE : GONE); | 2313 mMicButton.setVisibility(showMicButton ? VISIBLE : GONE); |
| 2323 } | 2314 } |
| 2324 | 2315 |
| 2325 /** | 2316 /** |
| 2326 * Call to force the UI to update the state of various buttons based on whet
her or not the | 2317 * Call to force the UI to update the state of various buttons based on whet
her or not the |
| 2327 * current tab is incognito. | 2318 * current tab is incognito. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2445 public View getContainerView() { | 2436 public View getContainerView() { |
| 2446 return this; | 2437 return this; |
| 2447 } | 2438 } |
| 2448 | 2439 |
| 2449 @Override | 2440 @Override |
| 2450 public void setTitleToPageTitle() { } | 2441 public void setTitleToPageTitle() { } |
| 2451 | 2442 |
| 2452 @Override | 2443 @Override |
| 2453 public void setShowTitle(boolean showTitle) { } | 2444 public void setShowTitle(boolean showTitle) { } |
| 2454 } | 2445 } |
| OLD | NEW |