| 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/autocomplete_match.h" | 5 #include "components/omnibox/autocomplete_match.h" |
| 6 | 6 |
| 7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 0x2029, // Paragraph separator | 35 0x2029, // Paragraph separator |
| 36 0 | 36 0 |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 AutocompleteMatch::AutocompleteMatch() | 39 AutocompleteMatch::AutocompleteMatch() |
| 40 : provider(NULL), | 40 : provider(NULL), |
| 41 relevance(0), | 41 relevance(0), |
| 42 typed_count(-1), | 42 typed_count(-1), |
| 43 deletable(false), | 43 deletable(false), |
| 44 allowed_to_be_default_match(false), | 44 allowed_to_be_default_match(false), |
| 45 transition(content::PAGE_TRANSITION_GENERATED), | 45 transition(ui::PAGE_TRANSITION_GENERATED), |
| 46 is_history_what_you_typed_match(false), | 46 is_history_what_you_typed_match(false), |
| 47 type(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED), | 47 type(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED), |
| 48 from_previous(false) { | 48 from_previous(false) { |
| 49 } | 49 } |
| 50 | 50 |
| 51 AutocompleteMatch::AutocompleteMatch(AutocompleteProvider* provider, | 51 AutocompleteMatch::AutocompleteMatch(AutocompleteProvider* provider, |
| 52 int relevance, | 52 int relevance, |
| 53 bool deletable, | 53 bool deletable, |
| 54 Type type) | 54 Type type) |
| 55 : provider(provider), | 55 : provider(provider), |
| 56 relevance(relevance), | 56 relevance(relevance), |
| 57 typed_count(-1), | 57 typed_count(-1), |
| 58 deletable(deletable), | 58 deletable(deletable), |
| 59 allowed_to_be_default_match(false), | 59 allowed_to_be_default_match(false), |
| 60 transition(content::PAGE_TRANSITION_TYPED), | 60 transition(ui::PAGE_TRANSITION_TYPED), |
| 61 is_history_what_you_typed_match(false), | 61 is_history_what_you_typed_match(false), |
| 62 type(type), | 62 type(type), |
| 63 from_previous(false) { | 63 from_previous(false) { |
| 64 } | 64 } |
| 65 | 65 |
| 66 AutocompleteMatch::AutocompleteMatch(const AutocompleteMatch& match) | 66 AutocompleteMatch::AutocompleteMatch(const AutocompleteMatch& match) |
| 67 : provider(match.provider), | 67 : provider(match.provider), |
| 68 relevance(match.relevance), | 68 relevance(match.relevance), |
| 69 typed_count(match.typed_count), | 69 typed_count(match.typed_count), |
| 70 deletable(match.deletable), | 70 deletable(match.deletable), |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 TemplateURLService* template_url_service, | 428 TemplateURLService* template_url_service, |
| 429 base::string16* keyword, | 429 base::string16* keyword, |
| 430 bool* is_keyword_hint) const { | 430 bool* is_keyword_hint) const { |
| 431 *is_keyword_hint = associated_keyword.get() != NULL; | 431 *is_keyword_hint = associated_keyword.get() != NULL; |
| 432 keyword->assign(*is_keyword_hint ? associated_keyword->keyword : | 432 keyword->assign(*is_keyword_hint ? associated_keyword->keyword : |
| 433 GetSubstitutingExplicitlyInvokedKeyword(template_url_service)); | 433 GetSubstitutingExplicitlyInvokedKeyword(template_url_service)); |
| 434 } | 434 } |
| 435 | 435 |
| 436 base::string16 AutocompleteMatch::GetSubstitutingExplicitlyInvokedKeyword( | 436 base::string16 AutocompleteMatch::GetSubstitutingExplicitlyInvokedKeyword( |
| 437 TemplateURLService* template_url_service) const { | 437 TemplateURLService* template_url_service) const { |
| 438 if (transition != content::PAGE_TRANSITION_KEYWORD || | 438 if (transition != ui::PAGE_TRANSITION_KEYWORD || |
| 439 template_url_service == NULL) { | 439 template_url_service == NULL) { |
| 440 return base::string16(); | 440 return base::string16(); |
| 441 } | 441 } |
| 442 | 442 |
| 443 const TemplateURL* t_url = GetTemplateURL(template_url_service, false); | 443 const TemplateURL* t_url = GetTemplateURL(template_url_service, false); |
| 444 return (t_url && | 444 return (t_url && |
| 445 t_url->SupportsReplacement( | 445 t_url->SupportsReplacement( |
| 446 template_url_service->search_terms_data())) ? | 446 template_url_service->search_terms_data())) ? |
| 447 keyword : base::string16(); | 447 keyword : base::string16(); |
| 448 } | 448 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 << " is unsorted in relation to last offset of " << last_offset | 534 << " is unsorted in relation to last offset of " << last_offset |
| 535 << ". Provider: " << provider_name << "."; | 535 << ". Provider: " << provider_name << "."; |
| 536 DCHECK_LT(i->offset, text.length()) | 536 DCHECK_LT(i->offset, text.length()) |
| 537 << " Classification of [" << i->offset << "," << text.length() | 537 << " Classification of [" << i->offset << "," << text.length() |
| 538 << "] is out of bounds for \"" << text << "\". Provider: " | 538 << "] is out of bounds for \"" << text << "\". Provider: " |
| 539 << provider_name << "."; | 539 << provider_name << "."; |
| 540 last_offset = i->offset; | 540 last_offset = i->offset; |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 #endif | 543 #endif |
| OLD | NEW |