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

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

Issue 18878007: Omnibox: Make the Controller Reorder Matches for Inlining (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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
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/extension_app_provider.h" 5 #include "chrome/browser/autocomplete/extension_app_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const ExtensionApp& app, 72 const ExtensionApp& app,
73 size_t name_match_index, 73 size_t name_match_index,
74 size_t url_match_index) { 74 size_t url_match_index) {
75 // TODO(finnur): Figure out what type to return here, might want to have 75 // TODO(finnur): Figure out what type to return here, might want to have
76 // the extension icon/a generic icon show up in the Omnibox. 76 // the extension icon/a generic icon show up in the Omnibox.
77 AutocompleteMatch match(this, 0, false, 77 AutocompleteMatch match(this, 0, false,
78 AutocompleteMatchType::EXTENSION_APP); 78 AutocompleteMatchType::EXTENSION_APP);
79 match.fill_into_edit = 79 match.fill_into_edit =
80 app.should_match_against_launch_url ? app.launch_url : input.text(); 80 app.should_match_against_launch_url ? app.launch_url : input.text();
81 match.destination_url = GURL(app.launch_url); 81 match.destination_url = GURL(app.launch_url);
82 match.allowed_to_be_default_match = true;
82 match.contents = AutocompleteMatch::SanitizeString(app.name); 83 match.contents = AutocompleteMatch::SanitizeString(app.name);
83 AutocompleteMatch::ClassifyLocationInString(name_match_index, 84 AutocompleteMatch::ClassifyLocationInString(name_match_index,
84 input.text().length(), app.name.length(), ACMatchClassification::NONE, 85 input.text().length(), app.name.length(), ACMatchClassification::NONE,
85 &match.contents_class); 86 &match.contents_class);
86 if (app.should_match_against_launch_url) { 87 if (app.should_match_against_launch_url) {
87 match.description = app.launch_url; 88 match.description = app.launch_url;
88 AutocompleteMatch::ClassifyLocationInString(url_match_index, 89 AutocompleteMatch::ClassifyLocationInString(url_match_index,
89 input.text().length(), app.launch_url.length(), 90 input.text().length(), app.launch_url.length(),
90 ACMatchClassification::URL, &match.description_class); 91 ACMatchClassification::URL, &match.description_class);
91 } 92 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 history::URLRow info; 216 history::URLRow info;
216 url_db->GetRowForURL(url, &info); 217 url_db->GetRowForURL(url, &info);
217 type_count_boost = 218 type_count_boost =
218 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); 219 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count())));
219 } 220 }
220 int relevance = 575 + static_cast<int>(type_count_boost) + 221 int relevance = 575 + static_cast<int>(type_count_boost) +
221 static_cast<int>(fraction_boost); 222 static_cast<int>(fraction_boost);
222 DCHECK_LE(relevance, kMaxRelevance); 223 DCHECK_LE(relevance, kMaxRelevance);
223 return relevance; 224 return relevance;
224 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698