| 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" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 14 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
| 15 #include "chrome/browser/autocomplete/autocomplete_input.h" | 15 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 16 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 16 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
| 18 #include "components/metrics/proto/omnibox_event.pb.h" |
| 18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 21 | 22 |
| 22 class AutocompleteController; | 23 class AutocompleteController; |
| 23 struct AutocompleteMatch; | 24 struct AutocompleteMatch; |
| 24 class AutocompleteResult; | 25 class AutocompleteResult; |
| 25 class Profile; | 26 class Profile; |
| 26 class Tab; | 27 class Tab; |
| 27 | 28 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 105 |
| 105 // AutocompleteControllerDelegate implementation. | 106 // AutocompleteControllerDelegate implementation. |
| 106 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; | 107 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; |
| 107 | 108 |
| 108 // Notifies the Java AutocompleteController that suggestions were received | 109 // Notifies the Java AutocompleteController that suggestions were received |
| 109 // based on the text the user typed in last. | 110 // based on the text the user typed in last. |
| 110 void NotifySuggestionsReceived( | 111 void NotifySuggestionsReceived( |
| 111 const AutocompleteResult& autocomplete_result); | 112 const AutocompleteResult& autocomplete_result); |
| 112 | 113 |
| 113 // Classifies the type of page we are on. | 114 // Classifies the type of page we are on. |
| 114 AutocompleteInput::PageClassification ClassifyPage( | 115 metrics::OmniboxEventProto::PageClassification ClassifyPage( |
| 115 const GURL& gurl, | 116 const GURL& gurl, |
| 116 bool is_query_in_omnibox, | 117 bool is_query_in_omnibox, |
| 117 bool focused_from_fakebox) const; | 118 bool focused_from_fakebox) const; |
| 118 | 119 |
| 119 base::android::ScopedJavaLocalRef<jobject> BuildOmniboxSuggestion( | 120 base::android::ScopedJavaLocalRef<jobject> BuildOmniboxSuggestion( |
| 120 JNIEnv* env, const AutocompleteMatch& match); | 121 JNIEnv* env, const AutocompleteMatch& match); |
| 121 | 122 |
| 122 // Converts destination_url (which is in its canonical form or punycode) to a | 123 // Converts destination_url (which is in its canonical form or punycode) to a |
| 123 // user-friendly URL by looking up accept languages of the current profile. | 124 // user-friendly URL by looking up accept languages of the current profile. |
| 124 // e.g. http://xn--6q8b.kr/ --> 한.kr | 125 // e.g. http://xn--6q8b.kr/ --> 한.kr |
| (...skipping 20 matching lines...) Expand all Loading... |
| 145 JavaObjectWeakGlobalRef weak_java_autocomplete_controller_android_; | 146 JavaObjectWeakGlobalRef weak_java_autocomplete_controller_android_; |
| 146 Profile* profile_; | 147 Profile* profile_; |
| 147 | 148 |
| 148 DISALLOW_COPY_AND_ASSIGN(AutocompleteControllerAndroid); | 149 DISALLOW_COPY_AND_ASSIGN(AutocompleteControllerAndroid); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 // Registers the LocationBar native method. | 152 // Registers the LocationBar native method. |
| 152 bool RegisterAutocompleteControllerAndroid(JNIEnv* env); | 153 bool RegisterAutocompleteControllerAndroid(JNIEnv* env); |
| 153 | 154 |
| 154 #endif // CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ | 155 #endif // CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ |
| OLD | NEW |