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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 } else { | 820 } else { |
821 mLocationBarIconActiveAnimator.setDuration(0); | 821 mLocationBarIconActiveAnimator.setDuration(0); |
822 } | 822 } |
823 mLocationBarIconActiveAnimator.start(); | 823 mLocationBarIconActiveAnimator.start(); |
824 } | 824 } |
825 | 825 |
826 @Override | 826 @Override |
827 public void onUrlPreFocusChanged(boolean gainFocus) { | 827 public void onUrlPreFocusChanged(boolean gainFocus) { |
828 if (mToolbarDataProvider == null || mToolbarDataProvider.getTab() == nul
l) return; | 828 if (mToolbarDataProvider == null || mToolbarDataProvider.getTab() == nul
l) return; |
829 | 829 |
830 if (!mQueryInTheOmnibox | 830 if (!mQueryInTheOmnibox && !TextUtils.isEmpty(mUrlBar.getText())) { |
831 && FeatureUtilities.isDocumentMode(getContext()) | |
832 && !TextUtils.isEmpty(mUrlBar.getText())) { | |
833 mUrlBar.setUrl(getOnlineUrlFromTab(), null); | 831 mUrlBar.setUrl(getOnlineUrlFromTab(), null); |
834 } | 832 } |
835 } | 833 } |
836 | 834 |
837 @Override | 835 @Override |
838 public void setUrlBarFocus(boolean shouldBeFocused) { | 836 public void setUrlBarFocus(boolean shouldBeFocused) { |
839 if (shouldBeFocused) { | 837 if (shouldBeFocused) { |
840 mUrlBar.requestFocus(); | 838 mUrlBar.requestFocus(); |
841 } else { | 839 } else { |
842 mUrlBar.clearFocus(); | 840 mUrlBar.clearFocus(); |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 if (getSecurityLevel() == ConnectionSecurityLevel.SECURITY_ERROR) { | 1966 if (getSecurityLevel() == ConnectionSecurityLevel.SECURITY_ERROR) { |
1969 assert false : "Search terms should not be shown for https error
pages."; | 1967 assert false : "Search terms should not be shown for https error
pages."; |
1970 displayText = url; | 1968 displayText = url; |
1971 } else { | 1969 } else { |
1972 url = displayText.trim(); | 1970 url = displayText.trim(); |
1973 showingQuery = true; | 1971 showingQuery = true; |
1974 mQueryInTheOmnibox = true; | 1972 mQueryInTheOmnibox = true; |
1975 } | 1973 } |
1976 } | 1974 } |
1977 String path = null; | 1975 String path = null; |
1978 if (!showingQuery && FeatureUtilities.isDocumentMode(getContext())) { | 1976 if (!showingQuery) { |
1979 Pair<String, String> urlText = splitPathFromUrlDisplayText(displayTe
xt); | 1977 Pair<String, String> urlText = splitPathFromUrlDisplayText(displayTe
xt); |
1980 displayText = urlText.first; | 1978 displayText = urlText.first; |
1981 path = urlText.second; | 1979 path = urlText.second; |
1982 } | 1980 } |
1983 | 1981 |
1984 if (setUrlBarText(displayText, path, url)) { | 1982 if (setUrlBarText(displayText, path, url)) { |
1985 mUrlBar.deEmphasizeUrl(); | 1983 mUrlBar.deEmphasizeUrl(); |
1986 emphasizeUrl(); | 1984 emphasizeUrl(); |
1987 } | 1985 } |
1988 if (showingQuery) { | 1986 if (showingQuery) { |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2426 public View getContainerView() { | 2424 public View getContainerView() { |
2427 return this; | 2425 return this; |
2428 } | 2426 } |
2429 | 2427 |
2430 @Override | 2428 @Override |
2431 public void setTitleToPageTitle() { } | 2429 public void setTitleToPageTitle() { } |
2432 | 2430 |
2433 @Override | 2431 @Override |
2434 public void setShowTitle(boolean showTitle) { } | 2432 public void setShowTitle(boolean showTitle) { } |
2435 } | 2433 } |
OLD | NEW |