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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 } | 620 } |
621 } | 621 } |
622 return idealListSize; | 622 return idealListSize; |
623 } | 623 } |
624 | 624 |
625 private int getDesiredWidth() { | 625 private int getDesiredWidth() { |
626 return mAnchorView.getWidth(); | 626 return mAnchorView.getWidth(); |
627 } | 627 } |
628 | 628 |
629 @Override | 629 @Override |
630 public void onWindowFocusChanged(boolean hasWindowFocus) { | |
631 super.onWindowFocusChanged(hasWindowFocus); | |
632 if (!hasWindowFocus && !mSuggestionModalShown) hideSuggestions(); | |
633 } | |
634 | |
635 @Override | |
636 protected void layoutChildren() { | 630 protected void layoutChildren() { |
637 super.layoutChildren(); | 631 super.layoutChildren(); |
638 // In ICS, the selected view is not marked as selected despite calli
ng setSelection(0), | 632 // In ICS, the selected view is not marked as selected despite calli
ng setSelection(0), |
639 // so we bootstrap this after the children have been laid out. | 633 // so we bootstrap this after the children have been laid out. |
640 if (!isInTouchMode() && getSelectedView() != null) { | 634 if (!isInTouchMode() && getSelectedView() != null) { |
641 getSelectedView().setSelected(true); | 635 getSelectedView().setSelected(true); |
642 } | 636 } |
643 } | 637 } |
644 | 638 |
645 private void updateSuggestionsLayoutDirection(int layoutDirection) { | 639 private void updateSuggestionsLayoutDirection(int layoutDirection) { |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 | 2360 |
2367 if (!mWindowAndroid.hasPermission(Manifest.permission.RECORD_AUDIO) | 2361 if (!mWindowAndroid.hasPermission(Manifest.permission.RECORD_AUDIO) |
2368 && !mWindowAndroid.canRequestPermission(Manifest.permission.RECO
RD_AUDIO)) { | 2362 && !mWindowAndroid.canRequestPermission(Manifest.permission.RECO
RD_AUDIO)) { |
2369 return false; | 2363 return false; |
2370 } | 2364 } |
2371 | 2365 |
2372 return FeatureUtilities.isRecognitionIntentPresent(getContext(), true); | 2366 return FeatureUtilities.isRecognitionIntentPresent(getContext(), true); |
2373 } | 2367 } |
2374 | 2368 |
2375 @Override | 2369 @Override |
| 2370 public void onWindowFocusChanged(boolean hasWindowFocus) { |
| 2371 super.onWindowFocusChanged(hasWindowFocus); |
| 2372 if (!hasWindowFocus && !mSuggestionModalShown) { |
| 2373 hideSuggestions(); |
| 2374 } else if (hasWindowFocus && mUrlHasFocus && mNativeInitialized) { |
| 2375 onTextChangedForAutocomplete(false); |
| 2376 } |
| 2377 } |
| 2378 |
| 2379 @Override |
2376 protected void onWindowVisibilityChanged(int visibility) { | 2380 protected void onWindowVisibilityChanged(int visibility) { |
2377 super.onWindowVisibilityChanged(visibility); | 2381 super.onWindowVisibilityChanged(visibility); |
2378 if (visibility == View.VISIBLE) updateMicButtonState(); | 2382 if (visibility == View.VISIBLE) updateMicButtonState(); |
2379 } | 2383 } |
2380 | 2384 |
2381 /** | 2385 /** |
2382 * Call to update the visibility of the buttons inside the location bar. | 2386 * Call to update the visibility of the buttons inside the location bar. |
2383 */ | 2387 */ |
2384 protected void updateButtonVisibility() { | 2388 protected void updateButtonVisibility() { |
2385 updateDeleteButtonVisibility(); | 2389 updateDeleteButtonVisibility(); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2537 public void setTitleToPageTitle() { } | 2541 public void setTitleToPageTitle() { } |
2538 | 2542 |
2539 @Override | 2543 @Override |
2540 public void setShowTitle(boolean showTitle) { } | 2544 public void setShowTitle(boolean showTitle) { } |
2541 | 2545 |
2542 @Override | 2546 @Override |
2543 public boolean mustQueryUrlBarLocationForSuggestions() { | 2547 public boolean mustQueryUrlBarLocationForSuggestions() { |
2544 return DeviceFormFactor.isTablet(); | 2548 return DeviceFormFactor.isTablet(); |
2545 } | 2549 } |
2546 } | 2550 } |
OLD | NEW |