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/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/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 supports_replacement, input.prefer_keyword(), | 439 supports_replacement, input.prefer_keyword(), |
| 440 input.allow_exact_keyword_match()); | 440 input.allow_exact_keyword_match()); |
| 441 } | 441 } |
| 442 AutocompleteMatch match(this, relevance, false, | 442 AutocompleteMatch match(this, relevance, false, |
| 443 supports_replacement ? AutocompleteMatchType::SEARCH_OTHER_ENGINE : | 443 supports_replacement ? AutocompleteMatchType::SEARCH_OTHER_ENGINE : |
| 444 AutocompleteMatchType::HISTORY_KEYWORD); | 444 AutocompleteMatchType::HISTORY_KEYWORD); |
| 445 match.fill_into_edit = keyword; | 445 match.fill_into_edit = keyword; |
| 446 if (!remaining_input.empty() || !keyword_complete || supports_replacement) | 446 if (!remaining_input.empty() || !keyword_complete || supports_replacement) |
| 447 match.fill_into_edit.push_back(L' '); | 447 match.fill_into_edit.push_back(L' '); |
| 448 match.fill_into_edit.append(remaining_input); | 448 match.fill_into_edit.append(remaining_input); |
| 449 // If we wanted to set |result.inline_autocomplete_offset| correctly, we'd | |
| 450 // need CleanUserInputKeyword() to return the amount of adjustment it's made | |
| 451 // to the user's input. Because right now inexact keyword matches can't score | |
| 452 // more highly than a "what you typed" match from one of the other providers, | |
| 453 // we just don't bother to do this, and leave inline autocompletion off. | |
|
Peter Kasting
2013/07/16 18:09:05
We should perhaps preserve the comment here about
Mark P
2013/07/16 18:53:23
Okay.
| |
| 454 match.inline_autocomplete_offset = string16::npos; | |
| 455 | 449 |
| 456 // Create destination URL and popup entry content by substituting user input | 450 // Create destination URL and popup entry content by substituting user input |
| 457 // into keyword templates. | 451 // into keyword templates. |
| 458 FillInURLAndContents(remaining_input, template_url, &match); | 452 FillInURLAndContents(remaining_input, template_url, &match); |
| 459 | 453 |
| 460 match.keyword = keyword; | 454 match.keyword = keyword; |
| 461 match.transition = content::PAGE_TRANSITION_KEYWORD; | 455 match.transition = content::PAGE_TRANSITION_KEYWORD; |
| 462 | 456 |
| 463 return match; | 457 return match; |
| 464 } | 458 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 } | 611 } |
| 618 | 612 |
| 619 void KeywordProvider::MaybeEndExtensionKeywordMode() { | 613 void KeywordProvider::MaybeEndExtensionKeywordMode() { |
| 620 if (!current_keyword_extension_id_.empty()) { | 614 if (!current_keyword_extension_id_.empty()) { |
| 621 extensions::ExtensionOmniboxEventRouter::OnInputCancelled( | 615 extensions::ExtensionOmniboxEventRouter::OnInputCancelled( |
| 622 profile_, current_keyword_extension_id_); | 616 profile_, current_keyword_extension_id_); |
| 623 | 617 |
| 624 current_keyword_extension_id_.clear(); | 618 current_keyword_extension_id_.clear(); |
| 625 } | 619 } |
| 626 } | 620 } |
| OLD | NEW |