Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/browser/android/omnibox/autocomplete_controller_android.cc

Issue 820063002: Add support for providers called when the omnibox is focused. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
90 // AutocompleteInput object. 90 // AutocompleteInput object.
91 base::string16 fake_request_source(base::ASCIIToUTF16( 91 base::string16 fake_request_source(base::ASCIIToUTF16(
92 "http://www.foobarbazblah.com")); 92 "http://www.foobarbazblah.com"));
93 controller_->StartZeroSuggest(AutocompleteInput( 93 controller_->StartOnOmniboxFocus(AutocompleteInput(
94 fake_request_source, base::string16::npos, std::string(), 94 fake_request_source, base::string16::npos, std::string(),
95 GURL(fake_request_source), OmniboxEventProto::INVALID_SPEC, false, false, 95 GURL(fake_request_source), OmniboxEventProto::INVALID_SPEC, false, false,
96 true, true, ChromeAutocompleteSchemeClassifier(profile))); 96 true, true, ChromeAutocompleteSchemeClassifier(profile)));
97 // Delete ourselves after 10s. This is enough time to cache results or 97 // Delete ourselves after 10s. This is enough time to cache results or
98 // give up if the results haven't been received. 98 // give up if the results haven't been received.
99 expire_timer_.Start(FROM_HERE, 99 expire_timer_.Start(FROM_HERE,
100 base::TimeDelta::FromMilliseconds(10000), 100 base::TimeDelta::FromMilliseconds(10000),
101 this, &ZeroSuggestPrefetcher::SelfDestruct); 101 this, &ZeroSuggestPrefetcher::SelfDestruct);
102 } 102 }
103 103
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return; 556 return;
557 557
558 // ZeroSuggestPrefetcher deletes itself after it's done prefetching. 558 // ZeroSuggestPrefetcher deletes itself after it's done prefetching.
559 new ZeroSuggestPrefetcher(profile); 559 new ZeroSuggestPrefetcher(profile);
560 } 560 }
561 561
562 // Register native methods 562 // Register native methods
563 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) { 563 bool RegisterAutocompleteControllerAndroid(JNIEnv* env) {
564 return RegisterNativesImpl(env); 564 return RegisterNativesImpl(env);
565 } 565 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698