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

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

Issue 10909130: autocomplete: Add AutocompleteProvider::Type enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comments Created 8 years, 3 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
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/zero_suggest_provider.h" 5 #include "chrome/browser/autocomplete/zero_suggest_provider.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_string_value_serializer.h" 8 #include "base/json/json_string_value_serializer.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 14 matching lines...) Expand all
25 25
26 namespace { 26 namespace {
27 // The relevance of the top match from this provider. 27 // The relevance of the top match from this provider.
28 const int kMaxZeroSuggestRelevance = 100; 28 const int kMaxZeroSuggestRelevance = 100;
29 } // namespace 29 } // namespace
30 30
31 ZeroSuggestProvider::ZeroSuggestProvider( 31 ZeroSuggestProvider::ZeroSuggestProvider(
32 AutocompleteProviderListener* listener, 32 AutocompleteProviderListener* listener,
33 Profile* profile, 33 Profile* profile,
34 const std::string& url_prefix) 34 const std::string& url_prefix)
35 : AutocompleteProvider(listener, profile, "ZeroSuggest"), 35 : AutocompleteProvider(listener,
36 profile,
37 AutocompleteProvider::TYPE_ZERO_SUGGEST),
36 url_prefix_(url_prefix), 38 url_prefix_(url_prefix),
37 template_url_service_(TemplateURLServiceFactory::GetForProfile(profile)) { 39 template_url_service_(TemplateURLServiceFactory::GetForProfile(profile)) {
38 } 40 }
39 41
40 void ZeroSuggestProvider::Start(const AutocompleteInput& input, 42 void ZeroSuggestProvider::Start(const AutocompleteInput& input,
41 bool /*minimal_changes*/) { 43 bool /*minimal_changes*/) {
42 UpdateMatches(input.text()); 44 UpdateMatches(input.text());
43 } 45 }
44 46
45 void ZeroSuggestProvider::StartZeroSuggest(const GURL& url, 47 void ZeroSuggestProvider::StartZeroSuggest(const GURL& url,
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Style to look like normal search suggestions. 216 // Style to look like normal search suggestions.
215 match.contents_class.push_back( 217 match.contents_class.push_back(
216 ACMatchClassification(0, ACMatchClassification::DIM)); 218 ACMatchClassification(0, ACMatchClassification::DIM));
217 match.contents_class.push_back( 219 match.contents_class.push_back(
218 ACMatchClassification(user_text_.length(), ACMatchClassification::NONE)); 220 ACMatchClassification(user_text_.length(), ACMatchClassification::NONE));
219 } 221 }
220 match.transition = content::PAGE_TRANSITION_GENERATED; 222 match.transition = content::PAGE_TRANSITION_GENERATED;
221 223
222 matches_.push_back(match); 224 matches_.push_back(match);
223 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698