| 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/autocomplete_match.h" | 5 #include "chrome/browser/autocomplete/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 27 matching lines...) Expand all Loading... |
| 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(content::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 starred(false), | |
| 49 from_previous(false) { | 48 from_previous(false) { |
| 50 } | 49 } |
| 51 | 50 |
| 52 AutocompleteMatch::AutocompleteMatch(AutocompleteProvider* provider, | 51 AutocompleteMatch::AutocompleteMatch(AutocompleteProvider* provider, |
| 53 int relevance, | 52 int relevance, |
| 54 bool deletable, | 53 bool deletable, |
| 55 Type type) | 54 Type type) |
| 56 : provider(provider), | 55 : provider(provider), |
| 57 relevance(relevance), | 56 relevance(relevance), |
| 58 typed_count(-1), | 57 typed_count(-1), |
| 59 deletable(deletable), | 58 deletable(deletable), |
| 60 allowed_to_be_default_match(false), | 59 allowed_to_be_default_match(false), |
| 61 transition(content::PAGE_TRANSITION_TYPED), | 60 transition(content::PAGE_TRANSITION_TYPED), |
| 62 is_history_what_you_typed_match(false), | 61 is_history_what_you_typed_match(false), |
| 63 type(type), | 62 type(type), |
| 64 starred(false), | |
| 65 from_previous(false) { | 63 from_previous(false) { |
| 66 } | 64 } |
| 67 | 65 |
| 68 AutocompleteMatch::AutocompleteMatch(const AutocompleteMatch& match) | 66 AutocompleteMatch::AutocompleteMatch(const AutocompleteMatch& match) |
| 69 : provider(match.provider), | 67 : provider(match.provider), |
| 70 relevance(match.relevance), | 68 relevance(match.relevance), |
| 71 typed_count(match.typed_count), | 69 typed_count(match.typed_count), |
| 72 deletable(match.deletable), | 70 deletable(match.deletable), |
| 73 fill_into_edit(match.fill_into_edit), | 71 fill_into_edit(match.fill_into_edit), |
| 74 inline_autocompletion(match.inline_autocompletion), | 72 inline_autocompletion(match.inline_autocompletion), |
| 75 allowed_to_be_default_match(match.allowed_to_be_default_match), | 73 allowed_to_be_default_match(match.allowed_to_be_default_match), |
| 76 destination_url(match.destination_url), | 74 destination_url(match.destination_url), |
| 77 stripped_destination_url(match.stripped_destination_url), | 75 stripped_destination_url(match.stripped_destination_url), |
| 78 contents(match.contents), | 76 contents(match.contents), |
| 79 contents_class(match.contents_class), | 77 contents_class(match.contents_class), |
| 80 description(match.description), | 78 description(match.description), |
| 81 description_class(match.description_class), | 79 description_class(match.description_class), |
| 82 answer_contents(match.answer_contents), | 80 answer_contents(match.answer_contents), |
| 83 answer_type(match.answer_type), | 81 answer_type(match.answer_type), |
| 84 transition(match.transition), | 82 transition(match.transition), |
| 85 is_history_what_you_typed_match(match.is_history_what_you_typed_match), | 83 is_history_what_you_typed_match(match.is_history_what_you_typed_match), |
| 86 type(match.type), | 84 type(match.type), |
| 87 associated_keyword(match.associated_keyword.get() ? | 85 associated_keyword(match.associated_keyword.get() ? |
| 88 new AutocompleteMatch(*match.associated_keyword) : NULL), | 86 new AutocompleteMatch(*match.associated_keyword) : NULL), |
| 89 keyword(match.keyword), | 87 keyword(match.keyword), |
| 90 starred(match.starred), | |
| 91 from_previous(match.from_previous), | 88 from_previous(match.from_previous), |
| 92 search_terms_args(match.search_terms_args.get() ? | 89 search_terms_args(match.search_terms_args.get() ? |
| 93 new TemplateURLRef::SearchTermsArgs(*match.search_terms_args) : | 90 new TemplateURLRef::SearchTermsArgs(*match.search_terms_args) : |
| 94 NULL), | 91 NULL), |
| 95 additional_info(match.additional_info), | 92 additional_info(match.additional_info), |
| 96 duplicate_matches(match.duplicate_matches) { | 93 duplicate_matches(match.duplicate_matches) { |
| 97 } | 94 } |
| 98 | 95 |
| 99 AutocompleteMatch::~AutocompleteMatch() { | 96 AutocompleteMatch::~AutocompleteMatch() { |
| 100 } | 97 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 118 description = match.description; | 115 description = match.description; |
| 119 description_class = match.description_class; | 116 description_class = match.description_class; |
| 120 answer_contents = match.answer_contents; | 117 answer_contents = match.answer_contents; |
| 121 answer_type = match.answer_type; | 118 answer_type = match.answer_type; |
| 122 transition = match.transition; | 119 transition = match.transition; |
| 123 is_history_what_you_typed_match = match.is_history_what_you_typed_match; | 120 is_history_what_you_typed_match = match.is_history_what_you_typed_match; |
| 124 type = match.type; | 121 type = match.type; |
| 125 associated_keyword.reset(match.associated_keyword.get() ? | 122 associated_keyword.reset(match.associated_keyword.get() ? |
| 126 new AutocompleteMatch(*match.associated_keyword) : NULL); | 123 new AutocompleteMatch(*match.associated_keyword) : NULL); |
| 127 keyword = match.keyword; | 124 keyword = match.keyword; |
| 128 starred = match.starred; | |
| 129 from_previous = match.from_previous; | 125 from_previous = match.from_previous; |
| 130 search_terms_args.reset(match.search_terms_args.get() ? | 126 search_terms_args.reset(match.search_terms_args.get() ? |
| 131 new TemplateURLRef::SearchTermsArgs(*match.search_terms_args) : NULL); | 127 new TemplateURLRef::SearchTermsArgs(*match.search_terms_args) : NULL); |
| 132 additional_info = match.additional_info; | 128 additional_info = match.additional_info; |
| 133 duplicate_matches = match.duplicate_matches; | 129 duplicate_matches = match.duplicate_matches; |
| 134 return *this; | 130 return *this; |
| 135 } | 131 } |
| 136 | 132 |
| 137 // static | 133 // static |
| 138 int AutocompleteMatch::TypeToIcon(Type type) { | 134 int AutocompleteMatch::TypeToIcon(Type type) { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 << " is unsorted in relation to last offset of " << last_offset | 534 << " is unsorted in relation to last offset of " << last_offset |
| 539 << ". Provider: " << provider_name << "."; | 535 << ". Provider: " << provider_name << "."; |
| 540 DCHECK_LT(i->offset, text.length()) | 536 DCHECK_LT(i->offset, text.length()) |
| 541 << " Classification of [" << i->offset << "," << text.length() | 537 << " Classification of [" << i->offset << "," << text.length() |
| 542 << "] is out of bounds for \"" << text << "\". Provider: " | 538 << "] is out of bounds for \"" << text << "\". Provider: " |
| 543 << provider_name << "."; | 539 << provider_name << "."; |
| 544 last_offset = i->offset; | 540 last_offset = i->offset; |
| 545 } | 541 } |
| 546 } | 542 } |
| 547 #endif | 543 #endif |
| OLD | NEW |