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/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 // For details on the format of the DictionaryValue that this function | 92 // For details on the format of the DictionaryValue that this function |
93 // populates, see the comments by OnResultChanged(). | 93 // populates, see the comments by OnResultChanged(). |
94 void OmniboxUIHandler::AddResultToDictionary(const std::string& prefix, | 94 void OmniboxUIHandler::AddResultToDictionary(const std::string& prefix, |
95 ACMatches::const_iterator it, | 95 ACMatches::const_iterator it, |
96 ACMatches::const_iterator end, | 96 ACMatches::const_iterator end, |
97 base::DictionaryValue* output) { | 97 base::DictionaryValue* output) { |
98 int i = 0; | 98 int i = 0; |
99 for (; it != end; ++it, ++i) { | 99 for (; it != end; ++it, ++i) { |
100 std::string item_prefix(prefix + StringPrintf(".item_%d", i)); | 100 std::string item_prefix(prefix + base::StringPrintf(".item_%d", i)); |
101 if (it->provider != NULL) { | 101 if (it->provider != NULL) { |
102 output->SetString(item_prefix + ".provider_name", | 102 output->SetString(item_prefix + ".provider_name", |
103 it->provider->GetName()); | 103 it->provider->GetName()); |
104 output->SetBoolean(item_prefix + ".provider_done", it->provider->done()); | 104 output->SetBoolean(item_prefix + ".provider_done", it->provider->done()); |
105 } | 105 } |
106 output->SetInteger(item_prefix + ".relevance", it->relevance); | 106 output->SetInteger(item_prefix + ".relevance", it->relevance); |
107 output->SetBoolean(item_prefix + ".deletable", it->deletable); | 107 output->SetBoolean(item_prefix + ".deletable", it->deletable); |
108 output->SetString(item_prefix + ".fill_into_edit", it->fill_into_edit); | 108 output->SetString(item_prefix + ".fill_into_edit", it->fill_into_edit); |
109 output->SetInteger(item_prefix + ".inline_autocomplete_offset", | 109 output->SetInteger(item_prefix + ".inline_autocomplete_offset", |
110 it->inline_autocomplete_offset); | 110 it->inline_autocomplete_offset); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 true, // allow exact keyword matches | 171 true, // allow exact keyword matches |
172 AutocompleteInput::ALL_MATCHES)); // want all matches | 172 AutocompleteInput::ALL_MATCHES)); // want all matches |
173 } | 173 } |
174 | 174 |
175 void OmniboxUIHandler::ResetController() { | 175 void OmniboxUIHandler::ResetController() { |
176 controller_.reset(new AutocompleteController(profile_, this, | 176 controller_.reset(new AutocompleteController(profile_, this, |
177 chrome::search::IsInstantExtendedAPIEnabled() ? | 177 chrome::search::IsInstantExtendedAPIEnabled() ? |
178 AutocompleteClassifier::kInstantExtendedOmniboxProviders : | 178 AutocompleteClassifier::kInstantExtendedOmniboxProviders : |
179 AutocompleteClassifier::kDefaultOmniboxProviders)); | 179 AutocompleteClassifier::kDefaultOmniboxProviders)); |
180 } | 180 } |
OLD | NEW |