| 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/options2/startup_pages_handler.h" | 5 #include "chrome/browser/ui/webui/options/startup_pages_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 10 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| 11 #include "chrome/browser/autocomplete/autocomplete_input.h" | 11 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 12 #include "chrome/browser/autocomplete/autocomplete_result.h" | 12 #include "chrome/browser/autocomplete/autocomplete_result.h" |
| 13 #include "chrome/browser/custom_home_pages_table_model.h" | 13 #include "chrome/browser/custom_home_pages_table_model.h" |
| 14 #include "chrome/browser/net/url_fixer_upper.h" | 14 #include "chrome/browser/net/url_fixer_upper.h" |
| 15 #include "chrome/browser/prefs/session_startup_pref.h" | 15 #include "chrome/browser/prefs/session_startup_pref.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 35 DCHECK(localized_strings); | 35 DCHECK(localized_strings); |
| 36 | 36 |
| 37 static OptionsStringResource resources[] = { | 37 static OptionsStringResource resources[] = { |
| 38 { "startupAddLabel", IDS_OPTIONS_STARTUP_ADD_LABEL }, | 38 { "startupAddLabel", IDS_OPTIONS_STARTUP_ADD_LABEL }, |
| 39 { "startupUseCurrent", IDS_OPTIONS_STARTUP_USE_CURRENT }, | 39 { "startupUseCurrent", IDS_OPTIONS_STARTUP_USE_CURRENT }, |
| 40 { "startupPagesPlaceholder", IDS_OPTIONS_STARTUP_PAGES_PLACEHOLDER }, | 40 { "startupPagesPlaceholder", IDS_OPTIONS_STARTUP_PAGES_PLACEHOLDER }, |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 RegisterStrings(localized_strings, resources, arraysize(resources)); | 43 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 44 RegisterTitle(localized_strings, "startupPagesOverlay", | 44 RegisterTitle(localized_strings, "startupPagesOverlay", |
| 45 IDS_OPTIONS2_STARTUP_PAGES_DIALOG_TITLE); | 45 IDS_OPTIONS_STARTUP_PAGES_DIALOG_TITLE); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void StartupPagesHandler::RegisterMessages() { | 48 void StartupPagesHandler::RegisterMessages() { |
| 49 web_ui()->RegisterMessageCallback("removeStartupPages", | 49 web_ui()->RegisterMessageCallback("removeStartupPages", |
| 50 base::Bind(&StartupPagesHandler::RemoveStartupPages, | 50 base::Bind(&StartupPagesHandler::RemoveStartupPages, |
| 51 base::Unretained(this))); | 51 base::Unretained(this))); |
| 52 web_ui()->RegisterMessageCallback("addStartupPage", | 52 web_ui()->RegisterMessageCallback("addStartupPage", |
| 53 base::Bind(&StartupPagesHandler::AddStartupPage, | 53 base::Bind(&StartupPagesHandler::AddStartupPage, |
| 54 base::Unretained(this))); | 54 base::Unretained(this))); |
| 55 web_ui()->RegisterMessageCallback("editStartupPage", | 55 web_ui()->RegisterMessageCallback("editStartupPage", |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 void StartupPagesHandler::OnResultChanged(bool default_match_changed) { | 251 void StartupPagesHandler::OnResultChanged(bool default_match_changed) { |
| 252 const AutocompleteResult& result = autocomplete_controller_->result(); | 252 const AutocompleteResult& result = autocomplete_controller_->result(); |
| 253 ListValue suggestions; | 253 ListValue suggestions; |
| 254 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 254 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
| 255 web_ui()->CallJavascriptFunction( | 255 web_ui()->CallJavascriptFunction( |
| 256 "StartupOverlay.updateAutocompleteSuggestions", suggestions); | 256 "StartupOverlay.updateAutocompleteSuggestions", suggestions); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace options | 259 } // namespace options |
| OLD | NEW |