| 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 | 449 // If we wanted to set |result.inline_autocompletion| correctly, we'd need |
| 450 // need CleanUserInputKeyword() to return the amount of adjustment it's made | 450 // CleanUserInputKeyword() to return the amount of adjustment it's made to |
| 451 // to the user's input. Because right now inexact keyword matches can't score | 451 // 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, | 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. | 453 // we just don't bother to do this, and leave inline autocompletion off. |
| 454 match.inline_autocomplete_offset = string16::npos; | |
| 455 | 454 |
| 456 // Create destination URL and popup entry content by substituting user input | 455 // Create destination URL and popup entry content by substituting user input |
| 457 // into keyword templates. | 456 // into keyword templates. |
| 458 FillInURLAndContents(remaining_input, template_url, &match); | 457 FillInURLAndContents(remaining_input, template_url, &match); |
| 459 | 458 |
| 460 match.keyword = keyword; | 459 match.keyword = keyword; |
| 461 match.transition = content::PAGE_TRANSITION_KEYWORD; | 460 match.transition = content::PAGE_TRANSITION_KEYWORD; |
| 462 | 461 |
| 463 return match; | 462 return match; |
| 464 } | 463 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 616 } |
| 618 | 617 |
| 619 void KeywordProvider::MaybeEndExtensionKeywordMode() { | 618 void KeywordProvider::MaybeEndExtensionKeywordMode() { |
| 620 if (!current_keyword_extension_id_.empty()) { | 619 if (!current_keyword_extension_id_.empty()) { |
| 621 extensions::ExtensionOmniboxEventRouter::OnInputCancelled( | 620 extensions::ExtensionOmniboxEventRouter::OnInputCancelled( |
| 622 profile_, current_keyword_extension_id_); | 621 profile_, current_keyword_extension_id_); |
| 623 | 622 |
| 624 current_keyword_extension_id_.clear(); | 623 current_keyword_extension_id_.clear(); |
| 625 } | 624 } |
| 626 } | 625 } |
| OLD | NEW |