| 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) && (it->template_url->url() != NULL)) { | 119 if (it->template_url != NULL) |
| 120 output->SetString(item_prefix + ".template_url", | 120 output->SetString(item_prefix + ".template_url", it->template_url->url()); |
| 121 it->template_url->url()->url()); | |
| 122 } | |
| 123 output->SetBoolean(item_prefix + ".starred", it->starred); | 121 output->SetBoolean(item_prefix + ".starred", it->starred); |
| 124 output->SetBoolean(item_prefix + ".from_previous", it->from_previous); | 122 output->SetBoolean(item_prefix + ".from_previous", it->from_previous); |
| 125 } | 123 } |
| 126 output->SetInteger(prefix + ".num_items", i); | 124 output->SetInteger(prefix + ".num_items", i); |
| 127 } | 125 } |
| 128 | 126 |
| 129 void OmniboxUIHandler::StartOmniboxQuery( | 127 void OmniboxUIHandler::StartOmniboxQuery( |
| 130 const base::ListValue* one_element_input_string) { | 128 const base::ListValue* one_element_input_string) { |
| 131 string16 input_string = ExtractStringValue(one_element_input_string); | 129 string16 input_string = ExtractStringValue(one_element_input_string); |
| 132 string16 empty_string; | 130 string16 empty_string; |
| 133 // Tell the autocomplete controller to start working on the | 131 // Tell the autocomplete controller to start working on the |
| 134 // input. It's okay if the previous request hasn't yet finished; | 132 // input. It's okay if the previous request hasn't yet finished; |
| 135 // the autocomplete controller is smart enough to stop the previous | 133 // the autocomplete controller is smart enough to stop the previous |
| 136 // query before it starts the new one. By the way, in this call to | 134 // query before it starts the new one. By the way, in this call to |
| 137 // Start(), we use the default/typical values for all parameters. | 135 // Start(), we use the default/typical values for all parameters. |
| 138 time_omnibox_started_ = base::Time::Now(); | 136 time_omnibox_started_ = base::Time::Now(); |
| 139 controller_->Start(input_string, | 137 controller_->Start(input_string, |
| 140 empty_string, // user's desired tld (top-level domain) | 138 empty_string, // user's desired tld (top-level domain) |
| 141 false, // don't prevent inline autocompletion | 139 false, // don't prevent inline autocompletion |
| 142 false, // no preferred keyword provider | 140 false, // no preferred keyword provider |
| 143 true, // allow exact keyword matches | 141 true, // allow exact keyword matches |
| 144 AutocompleteInput::ALL_MATCHES); // want all matches | 142 AutocompleteInput::ALL_MATCHES); // want all matches |
| 145 } | 143 } |
| OLD | NEW |