Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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.inline_autocomplete_offset = string16::npos; | 82 match.inline_autocomplete_offset = string16::npos; |
| 83 match.allowed_to_be_default_match = true; | |
|
msw
2013/07/18 06:23:57
Why is this always true?
Mark P
2013/07/21 20:31:05
Until very recently (when we disabled extensions/a
msw
2013/07/23 21:55:32
I suppose this change itself is okay then, should
Mark P
2013/07/26 16:48:13
I'll add an appropriate reviewer and ask these que
msw
2013/07/26 20:04:49
I think now would be okay. Your general approach s
| |
| 83 match.contents = AutocompleteMatch::SanitizeString(app.name); | 84 match.contents = AutocompleteMatch::SanitizeString(app.name); |
| 84 AutocompleteMatch::ClassifyLocationInString(name_match_index, | 85 AutocompleteMatch::ClassifyLocationInString(name_match_index, |
| 85 input.text().length(), app.name.length(), ACMatchClassification::NONE, | 86 input.text().length(), app.name.length(), ACMatchClassification::NONE, |
| 86 &match.contents_class); | 87 &match.contents_class); |
| 87 if (app.should_match_against_launch_url) { | 88 if (app.should_match_against_launch_url) { |
| 88 match.description = app.launch_url; | 89 match.description = app.launch_url; |
| 89 AutocompleteMatch::ClassifyLocationInString(url_match_index, | 90 AutocompleteMatch::ClassifyLocationInString(url_match_index, |
| 90 input.text().length(), app.launch_url.length(), | 91 input.text().length(), app.launch_url.length(), |
| 91 ACMatchClassification::URL, &match.description_class); | 92 ACMatchClassification::URL, &match.description_class); |
| 92 } | 93 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 history::URLRow info; | 217 history::URLRow info; |
| 217 url_db->GetRowForURL(url, &info); | 218 url_db->GetRowForURL(url, &info); |
| 218 type_count_boost = | 219 type_count_boost = |
| 219 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); | 220 400 * (1.0 - (std::pow(static_cast<double>(2), -info.typed_count()))); |
| 220 } | 221 } |
| 221 int relevance = 575 + static_cast<int>(type_count_boost) + | 222 int relevance = 575 + static_cast<int>(type_count_boost) + |
| 222 static_cast<int>(fraction_boost); | 223 static_cast<int>(fraction_boost); |
| 223 DCHECK_LE(relevance, kMaxRelevance); | 224 DCHECK_LE(relevance, kMaxRelevance); |
| 224 return relevance; | 225 return relevance; |
| 225 } | 226 } |
| OLD | NEW |