| 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 #include "chrome/browser/android/omnibox/autocomplete_controller_android.h" | 5 #include "chrome/browser/android/omnibox/autocomplete_controller_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 31 #include "components/bookmarks/browser/bookmark_model.h" | 31 #include "components/bookmarks/browser/bookmark_model.h" |
| 32 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 32 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 33 #include "components/metrics/proto/omnibox_event.pb.h" | 33 #include "components/metrics/proto/omnibox_event.pb.h" |
| 34 #include "components/omnibox/browser/autocomplete_classifier.h" | 34 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 35 #include "components/omnibox/browser/autocomplete_controller.h" | 35 #include "components/omnibox/browser/autocomplete_controller.h" |
| 36 #include "components/omnibox/browser/autocomplete_input.h" | 36 #include "components/omnibox/browser/autocomplete_input.h" |
| 37 #include "components/omnibox/browser/autocomplete_match.h" | 37 #include "components/omnibox/browser/autocomplete_match.h" |
| 38 #include "components/omnibox/browser/autocomplete_match_type.h" | 38 #include "components/omnibox/browser/autocomplete_match_type.h" |
| 39 #include "components/omnibox/browser/omnibox_event_global_tracker.h" |
| 39 #include "components/omnibox/browser/omnibox_field_trial.h" | 40 #include "components/omnibox/browser/omnibox_field_trial.h" |
| 40 #include "components/omnibox/browser/omnibox_log.h" | 41 #include "components/omnibox/browser/omnibox_log.h" |
| 41 #include "components/omnibox/browser/search_provider.h" | 42 #include "components/omnibox/browser/search_provider.h" |
| 42 #include "components/search/search.h" | 43 #include "components/search/search.h" |
| 43 #include "components/search_engines/template_url_service.h" | 44 #include "components/search_engines/template_url_service.h" |
| 44 #include "components/toolbar/toolbar_model.h" | 45 #include "components/toolbar/toolbar_model.h" |
| 45 #include "content/public/browser/notification_details.h" | 46 #include "content/public/browser/notification_details.h" |
| 46 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/browser/notification_source.h" | 48 #include "content/public/browser/notification_source.h" |
| 48 #include "content/public/browser/web_contents.h" | 49 #include "content/public/browser/web_contents.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 selected_index, | 231 selected_index, |
| 231 false, | 232 false, |
| 232 SessionTabHelper::IdForTab(web_contents), | 233 SessionTabHelper::IdForTab(web_contents), |
| 233 current_page_classification, | 234 current_page_classification, |
| 234 base::TimeDelta::FromMilliseconds(elapsed_time_since_first_modified), | 235 base::TimeDelta::FromMilliseconds(elapsed_time_since_first_modified), |
| 235 base::string16::npos, | 236 base::string16::npos, |
| 236 now - autocomplete_controller_->last_time_default_match_changed(), | 237 now - autocomplete_controller_->last_time_default_match_changed(), |
| 237 autocomplete_controller_->result()); | 238 autocomplete_controller_->result()); |
| 238 autocomplete_controller_->AddProvidersInfo(&log.providers_info); | 239 autocomplete_controller_->AddProvidersInfo(&log.providers_info); |
| 239 | 240 |
| 241 OmniboxEventGlobalTracker::GetInstance()->OnURLOpened(&log); |
| 240 content::NotificationService::current()->Notify( | 242 content::NotificationService::current()->Notify( |
| 241 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 243 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 242 content::Source<Profile>(profile_), | 244 content::Source<Profile>(profile_), |
| 243 content::Details<OmniboxLog>(&log)); | 245 content::Details<OmniboxLog>(&log)); |
| 244 } | 246 } |
| 245 | 247 |
| 246 void AutocompleteControllerAndroid::DeleteSuggestion(JNIEnv* env, | 248 void AutocompleteControllerAndroid::DeleteSuggestion(JNIEnv* env, |
| 247 jobject obj, | 249 jobject obj, |
| 248 int selected_index) { | 250 int selected_index) { |
| 249 const AutocompleteResult& result = autocomplete_controller_->result(); | 251 const AutocompleteResult& result = autocomplete_controller_->result(); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 return; | 556 return; |
| 555 | 557 |
| 556 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. | 558 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. |
| 557 new ZeroSuggestPrefetcher(profile); | 559 new ZeroSuggestPrefetcher(profile); |
| 558 } | 560 } |
| 559 | 561 |
| 560 // Register native methods | 562 // Register native methods |
| 561 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { | 563 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { |
| 562 return RegisterNativesImpl(env); | 564 return RegisterNativesImpl(env); |
| 563 } | 565 } |
| OLD | NEW |