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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/metrics/histogram_macros.h" | |
13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
18 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 19 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
19 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" | 20 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" |
20 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 21 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
21 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" | 22 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" |
22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
35 #include "components/metrics/proto/omnibox_event.pb.h" | 36 #include "components/metrics/proto/omnibox_event.pb.h" |
36 #include "components/omnibox/browser/autocomplete_classifier.h" | 37 #include "components/omnibox/browser/autocomplete_classifier.h" |
37 #include "components/omnibox/browser/autocomplete_controller.h" | 38 #include "components/omnibox/browser/autocomplete_controller.h" |
38 #include "components/omnibox/browser/autocomplete_input.h" | 39 #include "components/omnibox/browser/autocomplete_input.h" |
39 #include "components/omnibox/browser/autocomplete_match.h" | 40 #include "components/omnibox/browser/autocomplete_match.h" |
40 #include "components/omnibox/browser/autocomplete_match_type.h" | 41 #include "components/omnibox/browser/autocomplete_match_type.h" |
41 #include "components/omnibox/browser/omnibox_event_global_tracker.h" | 42 #include "components/omnibox/browser/omnibox_event_global_tracker.h" |
42 #include "components/omnibox/browser/omnibox_field_trial.h" | 43 #include "components/omnibox/browser/omnibox_field_trial.h" |
43 #include "components/omnibox/browser/omnibox_log.h" | 44 #include "components/omnibox/browser/omnibox_log.h" |
44 #include "components/omnibox/browser/search_provider.h" | 45 #include "components/omnibox/browser/search_provider.h" |
46 #include "components/open_from_clipboard/clipboard_recent_content.h" | |
45 #include "components/prefs/pref_service.h" | 47 #include "components/prefs/pref_service.h" |
46 #include "components/search_engines/template_url_service.h" | 48 #include "components/search_engines/template_url_service.h" |
47 #include "components/toolbar/toolbar_model.h" | 49 #include "components/toolbar/toolbar_model.h" |
48 #include "components/url_formatter/url_formatter.h" | 50 #include "components/url_formatter/url_formatter.h" |
49 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
50 #include "content/public/common/url_constants.h" | 52 #include "content/public/common/url_constants.h" |
51 #include "jni/AutocompleteController_jni.h" | 53 #include "jni/AutocompleteController_jni.h" |
52 #include "net/base/escape.h" | 54 #include "net/base/escape.h" |
53 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 55 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
54 | 56 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 jint completed_length, | 221 jint completed_length, |
220 const JavaParamRef<jobject>& j_web_contents) { | 222 const JavaParamRef<jobject>& j_web_contents) { |
221 base::string16 url = ConvertJavaStringToUTF16(env, j_current_url); | 223 base::string16 url = ConvertJavaStringToUTF16(env, j_current_url); |
222 const GURL current_url = GURL(url); | 224 const GURL current_url = GURL(url); |
223 OmniboxEventProto::PageClassification current_page_classification = | 225 OmniboxEventProto::PageClassification current_page_classification = |
224 ClassifyPage(current_url, focused_from_fakebox); | 226 ClassifyPage(current_url, focused_from_fakebox); |
225 const base::TimeTicks& now(base::TimeTicks::Now()); | 227 const base::TimeTicks& now(base::TimeTicks::Now()); |
226 content::WebContents* web_contents = | 228 content::WebContents* web_contents = |
227 content::WebContents::FromJavaWebContents(j_web_contents); | 229 content::WebContents::FromJavaWebContents(j_web_contents); |
228 | 230 |
231 if (autocomplete_controller_->result().match_at(selected_index).type == | |
Mark P
2017/04/01 05:21:04
For context, this call should be analogous to this
| |
232 AutocompleteMatchType::CLIPBOARD) { | |
233 UMA_HISTOGRAM_LONG_TIMES_100( | |
234 "MobileOmnibox.PressedClipboardSuggestionAge", | |
235 ClipboardRecentContent::GetInstance()->GetClipboardContentAge()); | |
236 } | |
229 OmniboxLog log( | 237 OmniboxLog log( |
230 // For zero suggest, record an empty input string instead of the | 238 // For zero suggest, record an empty input string instead of the |
231 // current URL. | 239 // current URL. |
232 input_.from_omnibox_focus() ? base::string16() : input_.text(), | 240 input_.from_omnibox_focus() ? base::string16() : input_.text(), |
233 false, /* don't know */ | 241 false, /* don't know */ |
234 input_.type(), | 242 input_.type(), |
235 true, | 243 true, |
236 selected_index, | 244 selected_index, |
237 false, | 245 false, |
238 SessionTabHelper::IdForTab(web_contents), | 246 SessionTabHelper::IdForTab(web_contents), |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 return; | 602 return; |
595 | 603 |
596 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. | 604 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. |
597 new ZeroSuggestPrefetcher(profile); | 605 new ZeroSuggestPrefetcher(profile); |
598 } | 606 } |
599 | 607 |
600 // Register native methods | 608 // Register native methods |
601 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { | 609 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { |
602 return RegisterNativesImpl(env); | 610 return RegisterNativesImpl(env); |
603 } | 611 } |
OLD | NEW |