| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/omnibox/base_search_provider.h" | 5 #include "components/omnibox/base_search_provider.h" |
| 6 | 6 |
| 7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/metrics/proto/omnibox_event.pb.h" | 10 #include "components/metrics/proto/omnibox_event.pb.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 kACMatchPropertyInputText, base::UTF16ToUTF8(input.text())); | 215 kACMatchPropertyInputText, base::UTF16ToUTF8(input.text())); |
| 216 match.RecordAdditionalInfo( | 216 match.RecordAdditionalInfo( |
| 217 kACMatchPropertyContentsPrefix, | 217 kACMatchPropertyContentsPrefix, |
| 218 base::UTF16ToUTF8(suggestion.match_contents_prefix())); | 218 base::UTF16ToUTF8(suggestion.match_contents_prefix())); |
| 219 match.RecordAdditionalInfo( | 219 match.RecordAdditionalInfo( |
| 220 kACMatchPropertyContentsStartIndex, | 220 kACMatchPropertyContentsStartIndex, |
| 221 static_cast<int>( | 221 static_cast<int>( |
| 222 suggestion.suggestion().length() - match.contents.length())); | 222 suggestion.suggestion().length() - match.contents.length())); |
| 223 } | 223 } |
| 224 | 224 |
| 225 if (!suggestion.annotation().empty()) | 225 if (!suggestion.annotation().empty()) { |
| 226 match.description = suggestion.annotation(); | 226 match.description = suggestion.annotation(); |
| 227 AutocompleteMatch::AddLastClassificationIfNecessary( |
| 228 &match.description_class, 0, ACMatchClassification::NONE); |
| 229 } |
| 227 | 230 |
| 228 // suggestion.match_contents() should have already been collapsed. | 231 // suggestion.match_contents() should have already been collapsed. |
| 229 match.allowed_to_be_default_match = | 232 match.allowed_to_be_default_match = |
| 230 (!in_keyword_mode || suggestion.from_keyword_provider()) && | 233 (!in_keyword_mode || suggestion.from_keyword_provider()) && |
| 231 (base::CollapseWhitespace(input.text(), false) == | 234 (base::CollapseWhitespace(input.text(), false) == |
| 232 suggestion.match_contents()); | 235 suggestion.match_contents()); |
| 233 | 236 |
| 234 // When the user forced a query, we need to make sure all the fill_into_edit | 237 // When the user forced a query, we need to make sure all the fill_into_edit |
| 235 // values preserve that property. Otherwise, if the user starts editing a | 238 // values preserve that property. Otherwise, if the user starts editing a |
| 236 // suggestion, non-Search results will suddenly appear. | 239 // suggestion, non-Search results will suddenly appear. |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 475 } |
| 473 | 476 |
| 474 void BaseSearchProvider::OnDeletionComplete( | 477 void BaseSearchProvider::OnDeletionComplete( |
| 475 bool success, SuggestionDeletionHandler* handler) { | 478 bool success, SuggestionDeletionHandler* handler) { |
| 476 RecordDeletionResult(success); | 479 RecordDeletionResult(success); |
| 477 SuggestionDeletionHandlers::iterator it = std::find( | 480 SuggestionDeletionHandlers::iterator it = std::find( |
| 478 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 481 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
| 479 DCHECK(it != deletion_handlers_.end()); | 482 DCHECK(it != deletion_handlers_.end()); |
| 480 deletion_handlers_.erase(it); | 483 deletion_handlers_.erase(it); |
| 481 } | 484 } |
| OLD | NEW |