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

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

Issue 10832256: Experimental AutocompleteProvider for zerosuggest. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
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_match.h" 5 #include "chrome/browser/autocomplete/autocomplete_match.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 "url-what-you-typed", 124 "url-what-you-typed",
125 "history-url", 125 "history-url",
126 "history-title", 126 "history-title",
127 "history-body", 127 "history-body",
128 "history-keyword", 128 "history-keyword",
129 "navsuggest", 129 "navsuggest",
130 "search-what-you-typed", 130 "search-what-you-typed",
131 "search-history", 131 "search-history",
132 "search-suggest", 132 "search-suggest",
133 "search-other-engine", 133 "search-other-engine",
134 "search-zerosuggest",
135 "search-zerosuggest-url",
134 "extension-app", 136 "extension-app",
135 }; 137 };
136 COMPILE_ASSERT(arraysize(strings) == NUM_TYPES, 138 COMPILE_ASSERT(arraysize(strings) == NUM_TYPES,
137 strings_array_must_match_type_enum); 139 strings_array_must_match_type_enum);
138 return strings[type]; 140 return strings[type];
139 } 141 }
140 142
141 // static 143 // static
142 int AutocompleteMatch::TypeToIcon(Type type) { 144 int AutocompleteMatch::TypeToIcon(Type type) {
143 int icons[] = { 145 int icons[] = {
144 IDR_OMNIBOX_HTTP, 146 IDR_OMNIBOX_HTTP,
145 IDR_OMNIBOX_HTTP, 147 IDR_OMNIBOX_HTTP,
146 IDR_OMNIBOX_HTTP, 148 IDR_OMNIBOX_HTTP,
147 IDR_OMNIBOX_HTTP, 149 IDR_OMNIBOX_HTTP,
148 IDR_OMNIBOX_HTTP, 150 IDR_OMNIBOX_HTTP,
149 IDR_OMNIBOX_HTTP, 151 IDR_OMNIBOX_HTTP,
150 IDR_OMNIBOX_SEARCH, 152 IDR_OMNIBOX_SEARCH,
151 IDR_OMNIBOX_SEARCH, 153 IDR_OMNIBOX_SEARCH,
152 IDR_OMNIBOX_SEARCH, 154 IDR_OMNIBOX_SEARCH,
153 IDR_OMNIBOX_SEARCH, 155 IDR_OMNIBOX_SEARCH,
156 IDR_OMNIBOX_SEARCH,
157 IDR_OMNIBOX_HTTP,
154 IDR_OMNIBOX_EXTENSION_APP, 158 IDR_OMNIBOX_EXTENSION_APP,
155 }; 159 };
156 COMPILE_ASSERT(arraysize(icons) == NUM_TYPES, 160 COMPILE_ASSERT(arraysize(icons) == NUM_TYPES,
157 icons_array_must_match_type_enum); 161 icons_array_must_match_type_enum);
158 return icons[type]; 162 return icons[type];
159 } 163 }
160 164
161 // static 165 // static
162 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, 166 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1,
163 const AutocompleteMatch& elem2) { 167 const AutocompleteMatch& elem2) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 << " is unsorted in relation to last offset of " << last_offset 378 << " is unsorted in relation to last offset of " << last_offset
375 << ". Provider: " << (provider ? provider->name() : "None") << "."; 379 << ". Provider: " << (provider ? provider->name() : "None") << ".";
376 DCHECK_LT(i->offset, text.length()) 380 DCHECK_LT(i->offset, text.length())
377 << " Classification of [" << i->offset << "," << text.length() 381 << " Classification of [" << i->offset << "," << text.length()
378 << "] is out of bounds for \"" << text << "\". Provider: " 382 << "] is out of bounds for \"" << text << "\". Provider: "
379 << (provider ? provider->name() : "None") << "."; 383 << (provider ? provider->name() : "None") << ".";
380 last_offset = i->offset; 384 last_offset = i->offset;
381 } 385 }
382 } 386 }
383 #endif 387 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698