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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_controller.cc

Issue 439243004: Stop depending on TemplateURLServiceFactory from SearchProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autocomplete/base_search_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/autocomplete/autocomplete_controller.h" 5 #include "chrome/browser/autocomplete/autocomplete_controller.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 providers_.push_back(history_url_provider_); 193 providers_.push_back(history_url_provider_);
194 } 194 }
195 // "Tab to search" can be used on all platforms other than Android. 195 // "Tab to search" can be used on all platforms other than Android.
196 #if !defined(OS_ANDROID) 196 #if !defined(OS_ANDROID)
197 if (provider_types & AutocompleteProvider::TYPE_KEYWORD) { 197 if (provider_types & AutocompleteProvider::TYPE_KEYWORD) {
198 keyword_provider_ = new KeywordProvider(this, profile); 198 keyword_provider_ = new KeywordProvider(this, profile);
199 providers_.push_back(keyword_provider_); 199 providers_.push_back(keyword_provider_);
200 } 200 }
201 #endif 201 #endif
202 if (provider_types & AutocompleteProvider::TYPE_SEARCH) { 202 if (provider_types & AutocompleteProvider::TYPE_SEARCH) {
203 search_provider_ = new SearchProvider(this, profile); 203 search_provider_ = new SearchProvider(this, template_url_service, profile);
204 providers_.push_back(search_provider_); 204 providers_.push_back(search_provider_);
205 } 205 }
206 if (provider_types & AutocompleteProvider::TYPE_SHORTCUTS) 206 if (provider_types & AutocompleteProvider::TYPE_SHORTCUTS)
207 providers_.push_back(new ShortcutsProvider(profile)); 207 providers_.push_back(new ShortcutsProvider(profile));
208 if (provider_types & AutocompleteProvider::TYPE_ZERO_SUGGEST) { 208 if (provider_types & AutocompleteProvider::TYPE_ZERO_SUGGEST) {
209 zero_suggest_provider_ = ZeroSuggestProvider::Create(this, profile); 209 zero_suggest_provider_ = ZeroSuggestProvider::Create(
210 this, template_url_service, profile);
210 if (zero_suggest_provider_) 211 if (zero_suggest_provider_)
211 providers_.push_back(zero_suggest_provider_); 212 providers_.push_back(zero_suggest_provider_);
212 } 213 }
213 } 214 }
214 215
215 AutocompleteController::~AutocompleteController() { 216 AutocompleteController::~AutocompleteController() {
216 // The providers may have tasks outstanding that hold refs to them. We need 217 // The providers may have tasks outstanding that hold refs to them. We need
217 // to ensure they won't call us back if they outlive us. (Practically, 218 // to ensure they won't call us back if they outlive us. (Practically,
218 // calling Stop() should also cancel those tasks and make it so that we hold 219 // calling Stop() should also cancel those tasks and make it so that we hold
219 // the only refs.) We also don't want to bother notifying anyone of our 220 // the only refs.) We also don't want to bother notifying anyone of our
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 this, &AutocompleteController::ExpireCopiedEntries); 651 this, &AutocompleteController::ExpireCopiedEntries);
651 } 652 }
652 653
653 void AutocompleteController::StartStopTimer() { 654 void AutocompleteController::StartStopTimer() {
654 stop_timer_.Start(FROM_HERE, 655 stop_timer_.Start(FROM_HERE,
655 stop_timer_duration_, 656 stop_timer_duration_,
656 base::Bind(&AutocompleteController::Stop, 657 base::Bind(&AutocompleteController::Stop,
657 base::Unretained(this), 658 base::Unretained(this),
658 false)); 659 false));
659 } 660 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/base_search_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698