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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 explicit ZeroSuggestPrefetcher(Profile* profile); | 73 explicit ZeroSuggestPrefetcher(Profile* profile); |
74 | 74 |
75 private: | 75 private: |
76 ~ZeroSuggestPrefetcher() override; | 76 ~ZeroSuggestPrefetcher() override; |
77 void SelfDestruct(); | 77 void SelfDestruct(); |
78 | 78 |
79 // AutocompleteControllerDelegate: | 79 // AutocompleteControllerDelegate: |
80 void OnResultChanged(bool default_match_changed) override; | 80 void OnResultChanged(bool default_match_changed) override; |
81 | 81 |
82 scoped_ptr<AutocompleteController> controller_; | 82 scoped_ptr<AutocompleteController> controller_; |
83 base::OneShotTimer<ZeroSuggestPrefetcher> expire_timer_; | 83 base::OneShotTimer expire_timer_; |
84 }; | 84 }; |
85 | 85 |
86 ZeroSuggestPrefetcher::ZeroSuggestPrefetcher(Profile* profile) | 86 ZeroSuggestPrefetcher::ZeroSuggestPrefetcher(Profile* profile) |
87 : controller_(new AutocompleteController( | 87 : controller_(new AutocompleteController( |
88 make_scoped_ptr(new ChromeAutocompleteProviderClient(profile)), | 88 make_scoped_ptr(new ChromeAutocompleteProviderClient(profile)), |
89 this, | 89 this, |
90 AutocompleteProvider::TYPE_ZERO_SUGGEST)) { | 90 AutocompleteProvider::TYPE_ZERO_SUGGEST)) { |
91 // Creating an arbitrary fake_request_source to avoid passing in an invalid | 91 // Creating an arbitrary fake_request_source to avoid passing in an invalid |
92 // AutocompleteInput object. | 92 // AutocompleteInput object. |
93 base::string16 fake_request_source(base::ASCIIToUTF16( | 93 base::string16 fake_request_source(base::ASCIIToUTF16( |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 return; | 561 return; |
562 | 562 |
563 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. | 563 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. |
564 new ZeroSuggestPrefetcher(profile); | 564 new ZeroSuggestPrefetcher(profile); |
565 } | 565 } |
566 | 566 |
567 // Register native methods | 567 // Register native methods |
568 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { | 568 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { |
569 return RegisterNativesImpl(env); | 569 return RegisterNativesImpl(env); |
570 } | 570 } |
OLD | NEW |