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/options/startup_pages_handler.h" | 5 #include "chrome/browser/ui/webui/options/startup_pages_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 for (int i = 0; i < page_count; ++i) { | 123 for (int i = 0; i < page_count; ++i) { |
124 base::DictionaryValue* entry = new base::DictionaryValue(); | 124 base::DictionaryValue* entry = new base::DictionaryValue(); |
125 entry->SetString("title", startup_custom_pages_table_model_->GetText(i, 0)); | 125 entry->SetString("title", startup_custom_pages_table_model_->GetText(i, 0)); |
126 entry->SetString("url", urls[i].spec()); | 126 entry->SetString("url", urls[i].spec()); |
127 entry->SetString("tooltip", | 127 entry->SetString("tooltip", |
128 startup_custom_pages_table_model_->GetTooltip(i)); | 128 startup_custom_pages_table_model_->GetTooltip(i)); |
129 entry->SetInteger("modelIndex", i); | 129 entry->SetInteger("modelIndex", i); |
130 startup_pages.Append(entry); | 130 startup_pages.Append(entry); |
131 } | 131 } |
132 | 132 |
133 web_ui()->CallJavascriptFunction("StartupOverlay.updateStartupPages", | 133 web_ui()->CallJavascriptFunctionUnsafe("StartupOverlay.updateStartupPages", |
134 startup_pages); | 134 startup_pages); |
135 } | 135 } |
136 | 136 |
137 void StartupPagesHandler::OnItemsChanged(int start, int length) { | 137 void StartupPagesHandler::OnItemsChanged(int start, int length) { |
138 OnModelChanged(); | 138 OnModelChanged(); |
139 } | 139 } |
140 | 140 |
141 void StartupPagesHandler::OnItemsAdded(int start, int length) { | 141 void StartupPagesHandler::OnItemsAdded(int start, int length) { |
142 OnModelChanged(); | 142 OnModelChanged(); |
143 } | 143 } |
144 | 144 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 autocomplete_controller_->Start(AutocompleteInput( | 255 autocomplete_controller_->Start(AutocompleteInput( |
256 input, base::string16::npos, std::string(), GURL(), | 256 input, base::string16::npos, std::string(), GURL(), |
257 metrics::OmniboxEventProto::INVALID_SPEC, true, false, false, true, false, | 257 metrics::OmniboxEventProto::INVALID_SPEC, true, false, false, true, false, |
258 ChromeAutocompleteSchemeClassifier(Profile::FromWebUI(web_ui())))); | 258 ChromeAutocompleteSchemeClassifier(Profile::FromWebUI(web_ui())))); |
259 } | 259 } |
260 | 260 |
261 void StartupPagesHandler::OnResultChanged(bool default_match_changed) { | 261 void StartupPagesHandler::OnResultChanged(bool default_match_changed) { |
262 const AutocompleteResult& result = autocomplete_controller_->result(); | 262 const AutocompleteResult& result = autocomplete_controller_->result(); |
263 base::ListValue suggestions; | 263 base::ListValue suggestions; |
264 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 264 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
265 web_ui()->CallJavascriptFunction( | 265 web_ui()->CallJavascriptFunctionUnsafe( |
266 "StartupOverlay.updateAutocompleteSuggestions", suggestions); | 266 "StartupOverlay.updateAutocompleteSuggestions", suggestions); |
267 } | 267 } |
268 | 268 |
269 } // namespace options | 269 } // namespace options |
OLD | NEW |