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