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