| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.searchwidget; | 5 package org.chromium.chrome.browser.searchwidget; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Handler; | 8 import android.os.Handler; |
| 9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
| 10 import android.util.AttributeSet; | 10 import android.util.AttributeSet; |
| 11 import android.view.View; | 11 import android.view.View; |
| 12 | 12 |
| 13 import org.chromium.chrome.R; | 13 import org.chromium.chrome.R; |
| 14 import org.chromium.chrome.browser.locale.LocaleManager; | |
| 15 import org.chromium.chrome.browser.omnibox.LocationBarLayout; | 14 import org.chromium.chrome.browser.omnibox.LocationBarLayout; |
| 16 import org.chromium.chrome.browser.profiles.Profile; | 15 import org.chromium.chrome.browser.profiles.Profile; |
| 17 import org.chromium.ui.UiUtils; | 16 import org.chromium.ui.UiUtils; |
| 18 | 17 |
| 19 /** Implementation of the {@link LocationBarLayout} that is displayed for widget
searches. */ | 18 /** Implementation of the {@link LocationBarLayout} that is displayed for widget
searches. */ |
| 20 public class SearchActivityLocationBarLayout extends LocationBarLayout { | 19 public class SearchActivityLocationBarLayout extends LocationBarLayout { |
| 21 /** Delegates calls out to the containing Activity. */ | 20 /** Delegates calls out to the containing Activity. */ |
| 22 public static interface Delegate { | 21 public static interface Delegate { |
| 23 /** Load a URL in the associated tab. */ | 22 /** Load a URL in the associated tab. */ |
| 24 void loadUrl(String url); | 23 void loadUrl(String url); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 35 } | 34 } |
| 36 | 35 |
| 37 /** Set the {@link Delegate}. */ | 36 /** Set the {@link Delegate}. */ |
| 38 void setDelegate(Delegate delegate) { | 37 void setDelegate(Delegate delegate) { |
| 39 mDelegate = delegate; | 38 mDelegate = delegate; |
| 40 } | 39 } |
| 41 | 40 |
| 42 @Override | 41 @Override |
| 43 protected void loadUrl(String url, int transition) { | 42 protected void loadUrl(String url, int transition) { |
| 44 mDelegate.loadUrl(url); | 43 mDelegate.loadUrl(url); |
| 45 LocaleManager.getInstance().recordLocaleBasedSearchMetrics(true, url, tr
ansition); | |
| 46 } | 44 } |
| 47 | 45 |
| 48 @Override | 46 @Override |
| 49 public void backKeyPressed() { | 47 public void backKeyPressed() { |
| 50 mDelegate.backKeyPressed(); | 48 mDelegate.backKeyPressed(); |
| 51 } | 49 } |
| 52 | 50 |
| 53 @Override | 51 @Override |
| 54 public boolean mustQueryUrlBarLocationForSuggestions() { | 52 public boolean mustQueryUrlBarLocationForSuggestions() { |
| 55 return true; | 53 return true; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 mUrlBar.setCursorVisible(true); | 98 mUrlBar.setCursorVisible(true); |
| 101 mUrlBar.setSelection(0, mUrlBar.getText().length()); | 99 mUrlBar.setSelection(0, mUrlBar.getText().length()); |
| 102 new Handler().post(new Runnable() { | 100 new Handler().post(new Runnable() { |
| 103 @Override | 101 @Override |
| 104 public void run() { | 102 public void run() { |
| 105 UiUtils.showKeyboard(mUrlBar); | 103 UiUtils.showKeyboard(mUrlBar); |
| 106 } | 104 } |
| 107 }); | 105 }); |
| 108 } | 106 } |
| 109 } | 107 } |
| OLD | NEW |