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

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

Issue 7607007: Add confidence to AutocompleteMatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/keyword_provider.h" 5 #include "chrome/browser/autocomplete/keyword_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 const bool keyword_complete = (prefix_length == keyword.length()); 407 const bool keyword_complete = (prefix_length == keyword.length());
408 if (relevance < 0) { 408 if (relevance < 0) {
409 relevance = 409 relevance =
410 CalculateRelevance(input.type(), keyword_complete, 410 CalculateRelevance(input.type(), keyword_complete,
411 // When the user wants keyword matches to take 411 // When the user wants keyword matches to take
412 // preference, score them highly regardless of 412 // preference, score them highly regardless of
413 // whether the input provides query text. 413 // whether the input provides query text.
414 supports_replacement, input.prefer_keyword(), 414 supports_replacement, input.prefer_keyword(),
415 input.allow_exact_keyword_match()); 415 input.allow_exact_keyword_match());
416 } 416 }
417 AutocompleteMatch result(this, relevance, false, 417 // TODO(dominich): Confidence. Not sure how to calculate it for this provider.
418 AutocompleteMatch result(this, relevance, 0.0f, false,
418 supports_replacement ? AutocompleteMatch::SEARCH_OTHER_ENGINE : 419 supports_replacement ? AutocompleteMatch::SEARCH_OTHER_ENGINE :
419 AutocompleteMatch::HISTORY_KEYWORD); 420 AutocompleteMatch::HISTORY_KEYWORD);
420 result.fill_into_edit.assign(keyword); 421 result.fill_into_edit.assign(keyword);
421 if (!remaining_input.empty() || !keyword_complete || supports_replacement) 422 if (!remaining_input.empty() || !keyword_complete || supports_replacement)
422 result.fill_into_edit.push_back(L' '); 423 result.fill_into_edit.push_back(L' ');
423 result.fill_into_edit.append(remaining_input); 424 result.fill_into_edit.append(remaining_input);
424 // If we wanted to set |result.inline_autocomplete_offset| correctly, we'd 425 // If we wanted to set |result.inline_autocomplete_offset| correctly, we'd
425 // need CleanUserInputKeyword() to return the amount of adjustment it's made 426 // need CleanUserInputKeyword() to return the amount of adjustment it's made
426 // to the user's input. Because right now inexact keyword matches can't score 427 // to the user's input. Because right now inexact keyword matches can't score
427 // more highly than a "what you typed" match from one of the other providers, 428 // more highly than a "what you typed" match from one of the other providers,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 531 }
531 532
532 void KeywordProvider::MaybeEndExtensionKeywordMode() { 533 void KeywordProvider::MaybeEndExtensionKeywordMode() {
533 if (!current_keyword_extension_id_.empty()) { 534 if (!current_keyword_extension_id_.empty()) {
534 ExtensionOmniboxEventRouter::OnInputCancelled( 535 ExtensionOmniboxEventRouter::OnInputCancelled(
535 profile_, current_keyword_extension_id_); 536 profile_, current_keyword_extension_id_);
536 537
537 current_keyword_extension_id_.clear(); 538 current_keyword_extension_id_.clear();
538 } 539 }
539 } 540 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698