OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ |
6 #define CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ | 6 #define CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 // Classifies the type of page we are on. | 120 // Classifies the type of page we are on. |
121 metrics::OmniboxEventProto::PageClassification ClassifyPage( | 121 metrics::OmniboxEventProto::PageClassification ClassifyPage( |
122 const GURL& gurl, | 122 const GURL& gurl, |
123 bool is_query_in_omnibox, | 123 bool is_query_in_omnibox, |
124 bool focused_from_fakebox) const; | 124 bool focused_from_fakebox) const; |
125 | 125 |
126 base::android::ScopedJavaLocalRef<jobject> BuildOmniboxSuggestion( | 126 base::android::ScopedJavaLocalRef<jobject> BuildOmniboxSuggestion( |
127 JNIEnv* env, const AutocompleteMatch& match); | 127 JNIEnv* env, const AutocompleteMatch& match); |
128 | 128 |
129 // Converts destination_url (which is in its canonical form or punycode) to a | |
130 // user-friendly URL by looking up accept languages of the current profile. | |
131 // e.g. http://xn--6q8b.kr/ --> 한.kr | |
132 base::string16 FormatURLUsingAcceptLanguages(GURL url); | |
133 | |
134 // A helper method for fetching the top synchronous autocomplete result. | 129 // A helper method for fetching the top synchronous autocomplete result. |
135 // The |prevent_inline_autocomplete| flag is passed to the AutocompleteInput | 130 // The |prevent_inline_autocomplete| flag is passed to the AutocompleteInput |
136 // object, see documentation there for its description. | 131 // object, see documentation there for its description. |
137 base::android::ScopedJavaLocalRef<jobject> GetTopSynchronousResult( | 132 base::android::ScopedJavaLocalRef<jobject> GetTopSynchronousResult( |
138 JNIEnv* env, | 133 JNIEnv* env, |
139 const base::android::JavaRef<jobject>& obj, | 134 const base::android::JavaRef<jobject>& obj, |
140 const base::android::JavaRef<jstring>& j_text, | 135 const base::android::JavaRef<jstring>& j_text, |
141 bool prevent_inline_autocomplete); | 136 bool prevent_inline_autocomplete); |
142 | 137 |
143 scoped_ptr<AutocompleteController> autocomplete_controller_; | 138 scoped_ptr<AutocompleteController> autocomplete_controller_; |
144 | 139 |
145 // Last input we sent to the autocomplete controller. | 140 // Last input we sent to the autocomplete controller. |
146 AutocompleteInput input_; | 141 AutocompleteInput input_; |
147 | 142 |
148 // Whether we're currently inside a call to Start() that's called | 143 // Whether we're currently inside a call to Start() that's called |
149 // from GetTopSynchronousResult(). | 144 // from GetTopSynchronousResult(). |
150 bool inside_synchronous_start_; | 145 bool inside_synchronous_start_; |
151 | 146 |
152 JavaObjectWeakGlobalRef weak_java_autocomplete_controller_android_; | 147 JavaObjectWeakGlobalRef weak_java_autocomplete_controller_android_; |
153 Profile* profile_; | 148 Profile* profile_; |
154 | 149 |
155 DISALLOW_COPY_AND_ASSIGN(AutocompleteControllerAndroid); | 150 DISALLOW_COPY_AND_ASSIGN(AutocompleteControllerAndroid); |
156 }; | 151 }; |
157 | 152 |
158 // Registers the LocationBar native method. | 153 // Registers the LocationBar native method. |
159 bool RegisterAutocompleteControllerAndroid(JNIEnv* env); | 154 bool RegisterAutocompleteControllerAndroid(JNIEnv* env); |
160 | 155 |
161 #endif // CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ | 156 #endif // CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ |
OLD | NEW |