| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 */ | 69 */ |
| 70 class ZeroSuggestPrefetcher : public AutocompleteControllerDelegate { | 70 class ZeroSuggestPrefetcher : public AutocompleteControllerDelegate { |
| 71 public: | 71 public: |
| 72 explicit ZeroSuggestPrefetcher(Profile* profile); | 72 explicit ZeroSuggestPrefetcher(Profile* profile); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 virtual ~ZeroSuggestPrefetcher(); | 75 virtual ~ZeroSuggestPrefetcher(); |
| 76 void SelfDestruct(); | 76 void SelfDestruct(); |
| 77 | 77 |
| 78 // AutocompleteControllerDelegate: | 78 // AutocompleteControllerDelegate: |
| 79 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; | 79 virtual void OnResultChanged(bool default_match_changed) override; |
| 80 | 80 |
| 81 scoped_ptr<AutocompleteController> controller_; | 81 scoped_ptr<AutocompleteController> controller_; |
| 82 base::OneShotTimer<ZeroSuggestPrefetcher> expire_timer_; | 82 base::OneShotTimer<ZeroSuggestPrefetcher> expire_timer_; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 ZeroSuggestPrefetcher::ZeroSuggestPrefetcher(Profile* profile) | 85 ZeroSuggestPrefetcher::ZeroSuggestPrefetcher(Profile* profile) |
| 86 : controller_(new AutocompleteController( | 86 : controller_(new AutocompleteController( |
| 87 profile, TemplateURLServiceFactory::GetForProfile(profile), this, | 87 profile, TemplateURLServiceFactory::GetForProfile(profile), this, |
| 88 AutocompleteProvider::TYPE_ZERO_SUGGEST)) { | 88 AutocompleteProvider::TYPE_ZERO_SUGGEST)) { |
| 89 // Creating an arbitrary fake_request_source to avoid passing in an invalid | 89 // Creating an arbitrary fake_request_source to avoid passing in an invalid |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 return; | 552 return; |
| 553 | 553 |
| 554 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. | 554 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. |
| 555 new ZeroSuggestPrefetcher(profile); | 555 new ZeroSuggestPrefetcher(profile); |
| 556 } | 556 } |
| 557 | 557 |
| 558 // Register native methods | 558 // Register native methods |
| 559 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { | 559 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { |
| 560 return RegisterNativesImpl(env); | 560 return RegisterNativesImpl(env); |
| 561 } | 561 } |
| OLD | NEW |