| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // Return first token as keyword. | 122 // Return first token as keyword. |
| 123 return input.substr(0, first_white); | 123 return input.substr(0, first_white); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // static | 126 // static |
| 127 base::string16 KeywordProvider::SplitReplacementStringFromInput( | 127 base::string16 KeywordProvider::SplitReplacementStringFromInput( |
| 128 const base::string16& input, | 128 const base::string16& input, |
| 129 bool trim_leading_whitespace) { | 129 bool trim_leading_whitespace) { |
| 130 // The input may contain leading whitespace, strip it. | 130 // The input may contain leading whitespace, strip it. |
| 131 base::string16 trimmed_input; | 131 base::string16 trimmed_input; |
| 132 TrimWhitespace(input, TRIM_LEADING, &trimmed_input); | 132 base::TrimWhitespace(input, base::TRIM_LEADING, &trimmed_input); |
| 133 | 133 |
| 134 // And extract the replacement string. | 134 // And extract the replacement string. |
| 135 base::string16 remaining_input; | 135 base::string16 remaining_input; |
| 136 SplitKeywordFromInput(trimmed_input, trim_leading_whitespace, | 136 SplitKeywordFromInput(trimmed_input, trim_leading_whitespace, |
| 137 &remaining_input); | 137 &remaining_input); |
| 138 return remaining_input; | 138 return remaining_input; |
| 139 } | 139 } |
| 140 | 140 |
| 141 // static | 141 // static |
| 142 const TemplateURL* KeywordProvider::GetSubstitutingTemplateURLForInput( | 142 const TemplateURL* KeywordProvider::GetSubstitutingTemplateURLForInput( |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 } | 629 } |
| 630 | 630 |
| 631 void KeywordProvider::MaybeEndExtensionKeywordMode() { | 631 void KeywordProvider::MaybeEndExtensionKeywordMode() { |
| 632 if (!current_keyword_extension_id_.empty()) { | 632 if (!current_keyword_extension_id_.empty()) { |
| 633 extensions::ExtensionOmniboxEventRouter::OnInputCancelled( | 633 extensions::ExtensionOmniboxEventRouter::OnInputCancelled( |
| 634 profile_, current_keyword_extension_id_); | 634 profile_, current_keyword_extension_id_); |
| 635 | 635 |
| 636 current_keyword_extension_id_.clear(); | 636 current_keyword_extension_id_.clear(); |
| 637 } | 637 } |
| 638 } | 638 } |
| OLD | NEW |