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/ui/webui/omnibox/omnibox_ui_handler.h" | 5 #include "chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // type of text it is. | 109 // type of text it is. |
110 output->SetString(item_prefix + ".description", it->description); | 110 output->SetString(item_prefix + ".description", it->description); |
111 // At this time, we're not bothering to send along the long vector that | 111 // At this time, we're not bothering to send along the long vector that |
112 // represents description classification. i.e., for each character, what | 112 // represents description classification. i.e., for each character, what |
113 // type of text it is. | 113 // type of text it is. |
114 output->SetInteger(item_prefix + ".transition", it->transition); | 114 output->SetInteger(item_prefix + ".transition", it->transition); |
115 output->SetBoolean(item_prefix + ".is_history_what_you_typed_match", | 115 output->SetBoolean(item_prefix + ".is_history_what_you_typed_match", |
116 it->is_history_what_you_typed_match); | 116 it->is_history_what_you_typed_match); |
117 output->SetString(item_prefix + ".type", | 117 output->SetString(item_prefix + ".type", |
118 AutocompleteMatch::TypeToString(it->type)); | 118 AutocompleteMatch::TypeToString(it->type)); |
119 if (it->template_url != NULL) | 119 if ((it->template_url != NULL) && (it->template_url->url() != NULL)) { |
120 output->SetString(item_prefix + ".template_url", it->template_url->url()); | 120 output->SetString(item_prefix + ".template_url", |
| 121 it->template_url->url()->url()); |
| 122 } |
121 output->SetBoolean(item_prefix + ".starred", it->starred); | 123 output->SetBoolean(item_prefix + ".starred", it->starred); |
122 output->SetBoolean(item_prefix + ".from_previous", it->from_previous); | 124 output->SetBoolean(item_prefix + ".from_previous", it->from_previous); |
123 } | 125 } |
124 output->SetInteger(prefix + ".num_items", i); | 126 output->SetInteger(prefix + ".num_items", i); |
125 } | 127 } |
126 | 128 |
127 void OmniboxUIHandler::StartOmniboxQuery( | 129 void OmniboxUIHandler::StartOmniboxQuery( |
128 const base::ListValue* one_element_input_string) { | 130 const base::ListValue* one_element_input_string) { |
129 string16 input_string = ExtractStringValue(one_element_input_string); | 131 string16 input_string = ExtractStringValue(one_element_input_string); |
130 string16 empty_string; | 132 string16 empty_string; |
131 // Tell the autocomplete controller to start working on the | 133 // Tell the autocomplete controller to start working on the |
132 // input. It's okay if the previous request hasn't yet finished; | 134 // input. It's okay if the previous request hasn't yet finished; |
133 // the autocomplete controller is smart enough to stop the previous | 135 // the autocomplete controller is smart enough to stop the previous |
134 // query before it starts the new one. By the way, in this call to | 136 // query before it starts the new one. By the way, in this call to |
135 // Start(), we use the default/typical values for all parameters. | 137 // Start(), we use the default/typical values for all parameters. |
136 time_omnibox_started_ = base::Time::Now(); | 138 time_omnibox_started_ = base::Time::Now(); |
137 controller_->Start(input_string, | 139 controller_->Start(input_string, |
138 empty_string, // user's desired tld (top-level domain) | 140 empty_string, // user's desired tld (top-level domain) |
139 false, // don't prevent inline autocompletion | 141 false, // don't prevent inline autocompletion |
140 false, // no preferred keyword provider | 142 false, // no preferred keyword provider |
141 true, // allow exact keyword matches | 143 true, // allow exact keyword matches |
142 AutocompleteInput::ALL_MATCHES); // want all matches | 144 AutocompleteInput::ALL_MATCHES); // want all matches |
143 } | 145 } |
OLD | NEW |