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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 import org.chromium.base.ApiCompatibilityUtils; | 54 import org.chromium.base.ApiCompatibilityUtils; |
55 import org.chromium.base.CollectionUtil; | 55 import org.chromium.base.CollectionUtil; |
56 import org.chromium.base.CommandLine; | 56 import org.chromium.base.CommandLine; |
57 import org.chromium.base.VisibleForTesting; | 57 import org.chromium.base.VisibleForTesting; |
58 import org.chromium.base.metrics.RecordHistogram; | 58 import org.chromium.base.metrics.RecordHistogram; |
59 import org.chromium.base.metrics.RecordUserAction; | 59 import org.chromium.base.metrics.RecordUserAction; |
60 import org.chromium.chrome.R; | 60 import org.chromium.chrome.R; |
61 import org.chromium.chrome.browser.ChromeActivity; | 61 import org.chromium.chrome.browser.ChromeActivity; |
62 import org.chromium.chrome.browser.ChromeSwitches; | 62 import org.chromium.chrome.browser.ChromeSwitches; |
| 63 import org.chromium.chrome.browser.NativePage; |
63 import org.chromium.chrome.browser.WindowDelegate; | 64 import org.chromium.chrome.browser.WindowDelegate; |
64 import org.chromium.chrome.browser.appmenu.AppMenuButtonHelper; | 65 import org.chromium.chrome.browser.appmenu.AppMenuButtonHelper; |
65 import org.chromium.chrome.browser.ntp.NativePageFactory; | 66 import org.chromium.chrome.browser.ntp.NativePageFactory; |
66 import org.chromium.chrome.browser.ntp.NewTabPage; | 67 import org.chromium.chrome.browser.ntp.NewTabPage; |
67 import org.chromium.chrome.browser.ntp.NewTabPage.FakeboxDelegate; | 68 import org.chromium.chrome.browser.ntp.NewTabPage.FakeboxDelegate; |
68 import org.chromium.chrome.browser.ntp.NewTabPageUma; | 69 import org.chromium.chrome.browser.ntp.NewTabPageUma; |
69 import org.chromium.chrome.browser.omnibox.AutocompleteController.OnSuggestionsR
eceivedListener; | 70 import org.chromium.chrome.browser.omnibox.AutocompleteController.OnSuggestionsR
eceivedListener; |
70 import org.chromium.chrome.browser.omnibox.OmniboxResultsAdapter.OmniboxResultIt
em; | 71 import org.chromium.chrome.browser.omnibox.OmniboxResultsAdapter.OmniboxResultIt
em; |
71 import org.chromium.chrome.browser.omnibox.OmniboxResultsAdapter.OmniboxSuggesti
onDelegate; | 72 import org.chromium.chrome.browser.omnibox.OmniboxResultsAdapter.OmniboxSuggesti
onDelegate; |
72 import org.chromium.chrome.browser.omnibox.VoiceSuggestionProvider.VoiceResult; | 73 import org.chromium.chrome.browser.omnibox.VoiceSuggestionProvider.VoiceResult; |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 } | 1129 } |
1129 | 1130 |
1130 if (pastedText != null) { | 1131 if (pastedText != null) { |
1131 // This must be happen after requestUrlFocus(), which changes the se
lection. | 1132 // This must be happen after requestUrlFocus(), which changes the se
lection. |
1132 mUrlBar.setUrl(pastedText, null); | 1133 mUrlBar.setUrl(pastedText, null); |
1133 mUrlBar.setSelection(mUrlBar.getText().length()); | 1134 mUrlBar.setSelection(mUrlBar.getText().length()); |
1134 } | 1135 } |
1135 } | 1136 } |
1136 | 1137 |
1137 @Override | 1138 @Override |
| 1139 public boolean isCurrentPage(NativePage nativePage) { |
| 1140 assert nativePage != null; |
| 1141 return nativePage == mToolbarDataProvider.getNewTabPageForCurrentTab(); |
| 1142 } |
| 1143 |
| 1144 @Override |
1138 public void showUrlBarCursorWithoutFocusAnimations() { | 1145 public void showUrlBarCursorWithoutFocusAnimations() { |
1139 if (mUrlHasFocus || mUrlFocusedFromFakebox) return; | 1146 if (mUrlHasFocus || mUrlFocusedFromFakebox) return; |
1140 | 1147 |
1141 mUrlFocusedWithoutAnimations = true; | 1148 mUrlFocusedWithoutAnimations = true; |
1142 setUrlBarFocus(true); | 1149 setUrlBarFocus(true); |
1143 } | 1150 } |
1144 | 1151 |
1145 /** | 1152 /** |
1146 * Sets the toolbar that owns this LocationBar. | 1153 * Sets the toolbar that owns this LocationBar. |
1147 */ | 1154 */ |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 public View getContainerView() { | 2467 public View getContainerView() { |
2461 return this; | 2468 return this; |
2462 } | 2469 } |
2463 | 2470 |
2464 @Override | 2471 @Override |
2465 public void setTitleToPageTitle() { } | 2472 public void setTitleToPageTitle() { } |
2466 | 2473 |
2467 @Override | 2474 @Override |
2468 public void setShowTitle(boolean showTitle) { } | 2475 public void setShowTitle(boolean showTitle) { } |
2469 } | 2476 } |
OLD | NEW |