| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 jobject j_web_contents); | 64 jobject j_web_contents); |
| 65 void DeleteSuggestion(JNIEnv* env, jobject obj, int selected_index); | 65 void DeleteSuggestion(JNIEnv* env, jobject obj, int selected_index); |
| 66 base::android::ScopedJavaLocalRef<jstring> | 66 base::android::ScopedJavaLocalRef<jstring> |
| 67 UpdateMatchDestinationURLWithQueryFormulationTime( | 67 UpdateMatchDestinationURLWithQueryFormulationTime( |
| 68 JNIEnv* env, | 68 JNIEnv* env, |
| 69 jobject obj, | 69 jobject obj, |
| 70 jint selected_index, | 70 jint selected_index, |
| 71 jlong elapsed_time_since_input_change); | 71 jlong elapsed_time_since_input_change); |
| 72 | 72 |
| 73 // KeyedService: | 73 // KeyedService: |
| 74 virtual void Shutdown() override; | 74 void Shutdown() override; |
| 75 | 75 |
| 76 class Factory : public BrowserContextKeyedServiceFactory { | 76 class Factory : public BrowserContextKeyedServiceFactory { |
| 77 public: | 77 public: |
| 78 static AutocompleteControllerAndroid* GetForProfile(Profile* profile, | 78 static AutocompleteControllerAndroid* GetForProfile(Profile* profile, |
| 79 JNIEnv* env, | 79 JNIEnv* env, |
| 80 jobject obj); | 80 jobject obj); |
| 81 | 81 |
| 82 static Factory* GetInstance(); | 82 static Factory* GetInstance(); |
| 83 | 83 |
| 84 protected: | 84 protected: |
| 85 virtual content::BrowserContext* GetBrowserContextToUse( | 85 content::BrowserContext* GetBrowserContextToUse( |
| 86 content::BrowserContext* context) const override; | 86 content::BrowserContext* context) const override; |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 friend struct DefaultSingletonTraits<Factory>; | 89 friend struct DefaultSingletonTraits<Factory>; |
| 90 | 90 |
| 91 Factory(); | 91 Factory(); |
| 92 virtual ~Factory(); | 92 ~Factory() override; |
| 93 | 93 |
| 94 // BrowserContextKeyedServiceFactory | 94 // BrowserContextKeyedServiceFactory |
| 95 virtual KeyedService* BuildServiceInstanceFor( | 95 KeyedService* BuildServiceInstanceFor( |
| 96 content::BrowserContext* profile) const override; | 96 content::BrowserContext* profile) const override; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 virtual ~AutocompleteControllerAndroid(); | 100 ~AutocompleteControllerAndroid() override; |
| 101 void InitJNI(JNIEnv* env, jobject obj); | 101 void InitJNI(JNIEnv* env, jobject obj); |
| 102 | 102 |
| 103 // AutocompleteControllerDelegate implementation. | 103 // AutocompleteControllerDelegate implementation. |
| 104 virtual void OnResultChanged(bool default_match_changed) override; | 104 void OnResultChanged(bool default_match_changed) override; |
| 105 | 105 |
| 106 // Notifies the Java AutocompleteController that suggestions were received | 106 // Notifies the Java AutocompleteController that suggestions were received |
| 107 // based on the text the user typed in last. | 107 // based on the text the user typed in last. |
| 108 void NotifySuggestionsReceived( | 108 void NotifySuggestionsReceived( |
| 109 const AutocompleteResult& autocomplete_result); | 109 const AutocompleteResult& autocomplete_result); |
| 110 | 110 |
| 111 // Classifies the type of page we are on. | 111 // Classifies the type of page we are on. |
| 112 metrics::OmniboxEventProto::PageClassification ClassifyPage( | 112 metrics::OmniboxEventProto::PageClassification ClassifyPage( |
| 113 const GURL& gurl, | 113 const GURL& gurl, |
| 114 bool is_query_in_omnibox, | 114 bool is_query_in_omnibox, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 143 JavaObjectWeakGlobalRef weak_java_autocomplete_controller_android_; | 143 JavaObjectWeakGlobalRef weak_java_autocomplete_controller_android_; |
| 144 Profile* profile_; | 144 Profile* profile_; |
| 145 | 145 |
| 146 DISALLOW_COPY_AND_ASSIGN(AutocompleteControllerAndroid); | 146 DISALLOW_COPY_AND_ASSIGN(AutocompleteControllerAndroid); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 // Registers the LocationBar native method. | 149 // Registers the LocationBar native method. |
| 150 bool RegisterAutocompleteControllerAndroid(JNIEnv* env); | 150 bool RegisterAutocompleteControllerAndroid(JNIEnv* env); |
| 151 | 151 |
| 152 #endif // CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ | 152 #endif // CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ |
| OLD | NEW |