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 27 matching lines...) Expand all Loading... |
38 0 | 38 0 |
39 }; | 39 }; |
40 | 40 |
41 AutocompleteMatch::AutocompleteMatch() | 41 AutocompleteMatch::AutocompleteMatch() |
42 : provider(NULL), | 42 : provider(NULL), |
43 relevance(0), | 43 relevance(0), |
44 typed_count(-1), | 44 typed_count(-1), |
45 deletable(false), | 45 deletable(false), |
46 allowed_to_be_default_match(false), | 46 allowed_to_be_default_match(false), |
47 transition(ui::PAGE_TRANSITION_GENERATED), | 47 transition(ui::PAGE_TRANSITION_GENERATED), |
48 is_history_what_you_typed_match(false), | |
49 type(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED), | 48 type(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED), |
50 from_previous(false) { | 49 from_previous(false) { |
51 } | 50 } |
52 | 51 |
53 AutocompleteMatch::AutocompleteMatch(AutocompleteProvider* provider, | 52 AutocompleteMatch::AutocompleteMatch(AutocompleteProvider* provider, |
54 int relevance, | 53 int relevance, |
55 bool deletable, | 54 bool deletable, |
56 Type type) | 55 Type type) |
57 : provider(provider), | 56 : provider(provider), |
58 relevance(relevance), | 57 relevance(relevance), |
59 typed_count(-1), | 58 typed_count(-1), |
60 deletable(deletable), | 59 deletable(deletable), |
61 allowed_to_be_default_match(false), | 60 allowed_to_be_default_match(false), |
62 transition(ui::PAGE_TRANSITION_TYPED), | 61 transition(ui::PAGE_TRANSITION_TYPED), |
63 is_history_what_you_typed_match(false), | |
64 type(type), | 62 type(type), |
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 answer(SuggestionAnswer::copy(match.answer.get())), | 82 answer(SuggestionAnswer::copy(match.answer.get())), |
85 transition(match.transition), | 83 transition(match.transition), |
86 is_history_what_you_typed_match(match.is_history_what_you_typed_match), | |
87 type(match.type), | 84 type(match.type), |
88 associated_keyword(match.associated_keyword.get() ? | 85 associated_keyword(match.associated_keyword.get() ? |
89 new AutocompleteMatch(*match.associated_keyword) : NULL), | 86 new AutocompleteMatch(*match.associated_keyword) : NULL), |
90 keyword(match.keyword), | 87 keyword(match.keyword), |
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) { |
(...skipping 17 matching lines...) Expand all Loading... |
114 destination_url = match.destination_url; | 111 destination_url = match.destination_url; |
115 stripped_destination_url = match.stripped_destination_url; | 112 stripped_destination_url = match.stripped_destination_url; |
116 contents = match.contents; | 113 contents = match.contents; |
117 contents_class = match.contents_class; | 114 contents_class = match.contents_class; |
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 answer = SuggestionAnswer::copy(match.answer.get()); | 119 answer = SuggestionAnswer::copy(match.answer.get()); |
123 transition = match.transition; | 120 transition = match.transition; |
124 is_history_what_you_typed_match = match.is_history_what_you_typed_match; | |
125 type = match.type; | 121 type = match.type; |
126 associated_keyword.reset(match.associated_keyword.get() ? | 122 associated_keyword.reset(match.associated_keyword.get() ? |
127 new AutocompleteMatch(*match.associated_keyword) : NULL); | 123 new AutocompleteMatch(*match.associated_keyword) : NULL); |
128 keyword = match.keyword; | 124 keyword = match.keyword; |
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; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 << " is unsorted in relation to last offset of " << last_offset | 557 << " is unsorted in relation to last offset of " << last_offset |
562 << ". Provider: " << provider_name << "."; | 558 << ". Provider: " << provider_name << "."; |
563 DCHECK_LT(i->offset, text.length()) | 559 DCHECK_LT(i->offset, text.length()) |
564 << " Classification of [" << i->offset << "," << text.length() | 560 << " Classification of [" << i->offset << "," << text.length() |
565 << "] is out of bounds for \"" << text << "\". Provider: " | 561 << "] is out of bounds for \"" << text << "\". Provider: " |
566 << provider_name << "."; | 562 << provider_name << "."; |
567 last_offset = i->offset; | 563 last_offset = i->offset; |
568 } | 564 } |
569 } | 565 } |
570 #endif | 566 #endif |
OLD | NEW |