| 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.animation.Animator; | 7 import android.animation.Animator; |
| 8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
| 9 import android.animation.ObjectAnimator; | 9 import android.animation.ObjectAnimator; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 return ChromeFeatureList.isEnabled("DownloadsUi") && shouldShowPageActio
nButtons() | 565 return ChromeFeatureList.isEnabled("DownloadsUi") && shouldShowPageActio
nButtons() |
| 566 && !tab.isIncognito(); | 566 && !tab.isIncognito(); |
| 567 } | 567 } |
| 568 | 568 |
| 569 private boolean isSaveOfflineButtonEnabled() { | 569 private boolean isSaveOfflineButtonEnabled() { |
| 570 if (mToolbarDataProvider == null) return false; | 570 if (mToolbarDataProvider == null) return false; |
| 571 Tab tab = mToolbarDataProvider.getTab(); | 571 Tab tab = mToolbarDataProvider.getTab(); |
| 572 if (tab == null) return false; | 572 if (tab == null) return false; |
| 573 boolean isChromeScheme = tab.getUrl().startsWith(UrlConstants.CHROME_SCH
EME) | 573 boolean isChromeScheme = tab.getUrl().startsWith(UrlConstants.CHROME_SCH
EME) |
| 574 || tab.getUrl().startsWith(UrlConstants.CHROME_NATIVE_SCHEME); | 574 || tab.getUrl().startsWith(UrlConstants.CHROME_NATIVE_SCHEME); |
| 575 return !isChromeScheme; | 575 boolean isValidTab = !tab.isOfflinePage() && !tab.isShowingErrorPage() |
| 576 && !tab.isShowingInterstitialPage(); |
| 577 return !isChromeScheme && isValidTab; |
| 576 } | 578 } |
| 577 | 579 |
| 578 private boolean shouldShowPageActionButtons() { | 580 private boolean shouldShowPageActionButtons() { |
| 579 if (!mNativeInitialized) return true; | 581 if (!mNativeInitialized) return true; |
| 580 | 582 |
| 581 // If the new downloads UI isn't enabled, the only page action is the bo
okmark button. It | 583 // If the new downloads UI isn't enabled, the only page action is the bo
okmark button. It |
| 582 // should be shown if the delete button isn't showing. If the download U
I is enabled, there | 584 // should be shown if the delete button isn't showing. If the download U
I is enabled, there |
| 583 // are two actions, bookmark and save offline, and they should be shown
if the omnibox isn't | 585 // are two actions, bookmark and save offline, and they should be shown
if the omnibox isn't |
| 584 // focused. | 586 // focused. |
| 585 return (!shouldShowDeleteButton() && !ChromeFeatureList.isEnabled("Downl
oadsUi")) | 587 return (!shouldShowDeleteButton() && !ChromeFeatureList.isEnabled("Downl
oadsUi")) |
| 586 || !(mUrlBar.hasFocus() || mUrlFocusChangeInProgress); | 588 || !(mUrlBar.hasFocus() || mUrlFocusChangeInProgress); |
| 587 } | 589 } |
| 588 | 590 |
| 589 private boolean shouldShowMicButton() { | 591 private boolean shouldShowMicButton() { |
| 590 // If the download UI is enabled, the mic button should be only be shown
when the url bar | 592 // If the download UI is enabled, the mic button should be only be shown
when the url bar |
| 591 // is focused. | 593 // is focused. |
| 592 return isVoiceSearchEnabled() && mNativeInitialized | 594 return isVoiceSearchEnabled() && mNativeInitialized |
| 593 && (!ChromeFeatureList.isEnabled("DownloadsUi") | 595 && (!ChromeFeatureList.isEnabled("DownloadsUi") |
| 594 || (mUrlBar.hasFocus() || mUrlFocusChangeInProgress)); | 596 || (mUrlBar.hasFocus() || mUrlFocusChangeInProgress)); |
| 595 } | 597 } |
| 596 } | 598 } |
| OLD | NEW |