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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/autocomplete/autocomplete.h" | 10 #include "chrome/browser/autocomplete/autocomplete.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 contents(match.contents), | 64 contents(match.contents), |
65 contents_class(match.contents_class), | 65 contents_class(match.contents_class), |
66 description(match.description), | 66 description(match.description), |
67 description_class(match.description_class), | 67 description_class(match.description_class), |
68 transition(match.transition), | 68 transition(match.transition), |
69 is_history_what_you_typed_match(match.is_history_what_you_typed_match), | 69 is_history_what_you_typed_match(match.is_history_what_you_typed_match), |
70 type(match.type), | 70 type(match.type), |
71 keyword(match.keyword), | 71 keyword(match.keyword), |
72 starred(match.starred), | 72 starred(match.starred), |
73 from_previous(match.from_previous) { | 73 from_previous(match.from_previous) { |
74 if (match.associated_keyword.get()) | 74 if (match.associated_keyword.get()) |
Peter Kasting
2012/06/22 21:48:31
Nit: For consistency, we could probably change the
Bart N
2012/06/22 22:42:01
Actually, to satisfy both performance & consistenc
| |
75 associated_keyword.reset(new AutocompleteMatch(*match.associated_keyword)); | 75 associated_keyword.reset(new AutocompleteMatch(*match.associated_keyword)); |
76 if (match.search_terms_args.get()) | |
77 search_terms_args.reset( | |
78 new TemplateURLRef::SearchTermsArgs(*match.search_terms_args)); | |
76 } | 79 } |
77 | 80 |
78 AutocompleteMatch::~AutocompleteMatch() { | 81 AutocompleteMatch::~AutocompleteMatch() { |
79 } | 82 } |
80 | 83 |
81 AutocompleteMatch& AutocompleteMatch::operator=( | 84 AutocompleteMatch& AutocompleteMatch::operator=( |
82 const AutocompleteMatch& match) { | 85 const AutocompleteMatch& match) { |
83 if (this == &match) | 86 if (this == &match) |
84 return *this; | 87 return *this; |
85 | 88 |
(...skipping 10 matching lines...) Expand all Loading... | |
96 description = match.description; | 99 description = match.description; |
97 description_class = match.description_class; | 100 description_class = match.description_class; |
98 transition = match.transition; | 101 transition = match.transition; |
99 is_history_what_you_typed_match = match.is_history_what_you_typed_match; | 102 is_history_what_you_typed_match = match.is_history_what_you_typed_match; |
100 type = match.type; | 103 type = match.type; |
101 associated_keyword.reset(match.associated_keyword.get() ? | 104 associated_keyword.reset(match.associated_keyword.get() ? |
102 new AutocompleteMatch(*match.associated_keyword) : NULL); | 105 new AutocompleteMatch(*match.associated_keyword) : NULL); |
103 keyword = match.keyword; | 106 keyword = match.keyword; |
104 starred = match.starred; | 107 starred = match.starred; |
105 from_previous = match.from_previous; | 108 from_previous = match.from_previous; |
106 | 109 search_terms_args.reset(match.search_terms_args.get() ? |
110 new TemplateURLRef::SearchTermsArgs(*match.search_terms_args) : NULL); | |
107 return *this; | 111 return *this; |
108 } | 112 } |
109 | 113 |
110 // static | 114 // static |
111 std::string AutocompleteMatch::TypeToString(Type type) { | 115 std::string AutocompleteMatch::TypeToString(Type type) { |
112 const char* strings[] = { | 116 const char* strings[] = { |
113 "url-what-you-typed", | 117 "url-what-you-typed", |
114 "history-url", | 118 "history-url", |
115 "history-title", | 119 "history-title", |
116 "history-body", | 120 "history-body", |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 << " is unsorted in relation to last offset of " << last_offset | 349 << " is unsorted in relation to last offset of " << last_offset |
346 << ". Provider: " << (provider ? provider->name() : "None") << "."; | 350 << ". Provider: " << (provider ? provider->name() : "None") << "."; |
347 DCHECK_LT(i->offset, text.length()) | 351 DCHECK_LT(i->offset, text.length()) |
348 << " Classification of [" << i->offset << "," << text.length() | 352 << " Classification of [" << i->offset << "," << text.length() |
349 << "] is out of bounds for \"" << text << "\". Provider: " | 353 << "] is out of bounds for \"" << text << "\". Provider: " |
350 << (provider ? provider->name() : "None") << "."; | 354 << (provider ? provider->name() : "None") << "."; |
351 last_offset = i->offset; | 355 last_offset = i->offset; |
352 } | 356 } |
353 } | 357 } |
354 #endif | 358 #endif |
OLD | NEW |