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