| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 jboolean focused_from_fakebox, | 60 jboolean focused_from_fakebox, |
| 61 jlong elapsed_time_since_first_modified, | 61 jlong elapsed_time_since_first_modified, |
| 62 jobject j_web_contents); | 62 jobject j_web_contents); |
| 63 void DeleteSuggestion(JNIEnv* env, jobject obj, int selected_index); | 63 void DeleteSuggestion(JNIEnv* env, jobject obj, int selected_index); |
| 64 base::android::ScopedJavaLocalRef<jstring> UpdateMatchDestinationURL( | 64 base::android::ScopedJavaLocalRef<jstring> UpdateMatchDestinationURL( |
| 65 JNIEnv* env, | 65 JNIEnv* env, |
| 66 jobject obj, | 66 jobject obj, |
| 67 jint selected_index, | 67 jint selected_index, |
| 68 jlong elapsed_time_since_input_change); | 68 jlong elapsed_time_since_input_change); |
| 69 | 69 |
| 70 base::android::ScopedJavaLocalRef<jobject> GetTopSynchronousMatch( |
| 71 JNIEnv* env, |
| 72 jobject obj, |
| 73 jstring query); |
| 74 |
| 70 // KeyedService: | 75 // KeyedService: |
| 71 virtual void Shutdown() OVERRIDE; | 76 virtual void Shutdown() OVERRIDE; |
| 72 | 77 |
| 73 class Factory : public BrowserContextKeyedServiceFactory { | 78 class Factory : public BrowserContextKeyedServiceFactory { |
| 74 public: | 79 public: |
| 75 static AutocompleteControllerAndroid* GetForProfile(Profile* profile, | 80 static AutocompleteControllerAndroid* GetForProfile(Profile* profile, |
| 76 JNIEnv* env, | 81 JNIEnv* env, |
| 77 jobject obj); | 82 jobject obj); |
| 78 | 83 |
| 79 static Factory* GetInstance(); | 84 static Factory* GetInstance(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 bool focused_from_fakebox) const; | 117 bool focused_from_fakebox) const; |
| 113 | 118 |
| 114 base::android::ScopedJavaLocalRef<jobject> BuildOmniboxSuggestion( | 119 base::android::ScopedJavaLocalRef<jobject> BuildOmniboxSuggestion( |
| 115 JNIEnv* env, const AutocompleteMatch& match); | 120 JNIEnv* env, const AutocompleteMatch& match); |
| 116 | 121 |
| 117 // Converts destination_url (which is in its canonical form or punycode) to a | 122 // Converts destination_url (which is in its canonical form or punycode) to a |
| 118 // user-friendly URL by looking up accept languages of the current profile. | 123 // user-friendly URL by looking up accept languages of the current profile. |
| 119 // e.g. http://xn--6q8b.kr/ --> 한.kr | 124 // e.g. http://xn--6q8b.kr/ --> 한.kr |
| 120 base::string16 FormatURLUsingAcceptLanguages(GURL url); | 125 base::string16 FormatURLUsingAcceptLanguages(GURL url); |
| 121 | 126 |
| 127 // A helper method for fetching the top synchronous autocomplete result. |
| 128 // The |prevent_inline_autocomplete| flag is passed to the AutocompleteInput |
| 129 // object, see documentation there for its description. |
| 130 base::android::ScopedJavaLocalRef<jobject> GetTopSynchronousResult( |
| 131 JNIEnv* env, |
| 132 jobject obj, |
| 133 jstring j_text, |
| 134 bool prevent_inline_autocomplete); |
| 135 |
| 122 scoped_ptr<AutocompleteController> autocomplete_controller_; | 136 scoped_ptr<AutocompleteController> autocomplete_controller_; |
| 123 | 137 |
| 124 // Last input we sent to the autocomplete controller. | 138 // Last input we sent to the autocomplete controller. |
| 125 AutocompleteInput input_; | 139 AutocompleteInput input_; |
| 126 | 140 |
| 127 // Whether we're currently inside a call to Classify(). | 141 // Whether we're currently inside a call to Start() that's called |
| 128 bool inside_classify_; | 142 // from GetTopSynchronousResult(). |
| 143 bool inside_synchronous_start_; |
| 129 | 144 |
| 130 JavaObjectWeakGlobalRef weak_java_autocomplete_controller_android_; | 145 JavaObjectWeakGlobalRef weak_java_autocomplete_controller_android_; |
| 131 Profile* profile_; | 146 Profile* profile_; |
| 132 | 147 |
| 133 DISALLOW_COPY_AND_ASSIGN(AutocompleteControllerAndroid); | 148 DISALLOW_COPY_AND_ASSIGN(AutocompleteControllerAndroid); |
| 134 }; | 149 }; |
| 135 | 150 |
| 136 // Registers the LocationBar native method. | 151 // Registers the LocationBar native method. |
| 137 bool RegisterAutocompleteControllerAndroid(JNIEnv* env); | 152 bool RegisterAutocompleteControllerAndroid(JNIEnv* env); |
| 138 | 153 |
| 139 #endif // CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ | 154 #endif // CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ |
| OLD | NEW |