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 25 matching lines...) Expand all Loading... |
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_event_global_tracker.h" |
40 #include "components/omnibox/browser/omnibox_field_trial.h" | 40 #include "components/omnibox/browser/omnibox_field_trial.h" |
41 #include "components/omnibox/browser/omnibox_log.h" | 41 #include "components/omnibox/browser/omnibox_log.h" |
42 #include "components/omnibox/browser/search_provider.h" | 42 #include "components/omnibox/browser/search_provider.h" |
43 #include "components/search/search.h" | 43 #include "components/search/search.h" |
44 #include "components/search_engines/template_url_service.h" | 44 #include "components/search_engines/template_url_service.h" |
45 #include "components/toolbar/toolbar_model.h" | 45 #include "components/toolbar/toolbar_model.h" |
| 46 #include "components/url_formatter/url_formatter.h" |
46 #include "content/public/browser/notification_details.h" | 47 #include "content/public/browser/notification_details.h" |
47 #include "content/public/browser/notification_service.h" | 48 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/notification_source.h" | 49 #include "content/public/browser/notification_source.h" |
49 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
50 #include "content/public/common/url_constants.h" | 51 #include "content/public/common/url_constants.h" |
51 #include "jni/AutocompleteController_jni.h" | 52 #include "jni/AutocompleteController_jni.h" |
52 #include "net/base/escape.h" | 53 #include "net/base/escape.h" |
53 #include "net/base/net_util.h" | |
54 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 54 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
55 | 55 |
56 using base::android::AttachCurrentThread; | 56 using base::android::AttachCurrentThread; |
57 using base::android::ConvertJavaStringToUTF16; | 57 using base::android::ConvertJavaStringToUTF16; |
58 using base::android::ConvertUTF8ToJavaString; | 58 using base::android::ConvertUTF8ToJavaString; |
59 using base::android::ConvertUTF16ToJavaString; | 59 using base::android::ConvertUTF16ToJavaString; |
60 using bookmarks::BookmarkModel; | 60 using bookmarks::BookmarkModel; |
61 using metrics::OmniboxEventProto; | 61 using metrics::OmniboxEventProto; |
62 | 62 |
63 namespace { | 63 namespace { |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 470 } |
471 | 471 |
472 base::string16 AutocompleteControllerAndroid::FormatURLUsingAcceptLanguages( | 472 base::string16 AutocompleteControllerAndroid::FormatURLUsingAcceptLanguages( |
473 GURL url) { | 473 GURL url) { |
474 if (profile_ == NULL) | 474 if (profile_ == NULL) |
475 return base::string16(); | 475 return base::string16(); |
476 | 476 |
477 std::string languages( | 477 std::string languages( |
478 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 478 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
479 | 479 |
480 return net::FormatUrl(url, languages, net::kFormatUrlOmitAll, | 480 return url_formatter::FormatUrl( |
481 net::UnescapeRule::SPACES, NULL, NULL, NULL); | 481 url, languages, url_formatter::kFormatUrlOmitAll, |
| 482 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); |
482 } | 483 } |
483 | 484 |
484 ScopedJavaLocalRef<jobject> | 485 ScopedJavaLocalRef<jobject> |
485 AutocompleteControllerAndroid::GetTopSynchronousResult( | 486 AutocompleteControllerAndroid::GetTopSynchronousResult( |
486 JNIEnv* env, | 487 JNIEnv* env, |
487 jobject obj, | 488 jobject obj, |
488 jstring j_text, | 489 jstring j_text, |
489 bool prevent_inline_autocomplete) { | 490 bool prevent_inline_autocomplete) { |
490 if (!autocomplete_controller_) | 491 if (!autocomplete_controller_) |
491 return ScopedJavaLocalRef<jobject>(); | 492 return ScopedJavaLocalRef<jobject>(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 return; | 557 return; |
557 | 558 |
558 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. | 559 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. |
559 new ZeroSuggestPrefetcher(profile); | 560 new ZeroSuggestPrefetcher(profile); |
560 } | 561 } |
561 | 562 |
562 // Register native methods | 563 // Register native methods |
563 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { | 564 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { |
564 return RegisterNativesImpl(env); | 565 return RegisterNativesImpl(env); |
565 } | 566 } |
OLD | NEW |