Chromium Code Reviews| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 { "startupUseCurrent", IDS_OPTIONS_STARTUP_USE_CURRENT }, | 41 { "startupUseCurrent", IDS_OPTIONS_STARTUP_USE_CURRENT }, |
| 42 { "startupPagesPlaceholder", IDS_OPTIONS_STARTUP_PAGES_PLACEHOLDER }, | 42 { "startupPagesPlaceholder", IDS_OPTIONS_STARTUP_PAGES_PLACEHOLDER }, |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 RegisterStrings(localized_strings, resources, arraysize(resources)); | 45 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 46 RegisterTitle(localized_strings, "startupPagesOverlay", | 46 RegisterTitle(localized_strings, "startupPagesOverlay", |
| 47 IDS_OPTIONS_STARTUP_PAGES_DIALOG_TITLE); | 47 IDS_OPTIONS_STARTUP_PAGES_DIALOG_TITLE); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void StartupPagesHandler::RegisterMessages() { | 50 void StartupPagesHandler::RegisterMessages() { |
| 51 // Guest profiles should never have been displayed the option to set | |
| 52 // these values. | |
|
Evan Stade
2014/08/19 17:49:13
nit: I don't think this comment is necessary
Mike Lerman
2014/08/19 20:34:12
Acknowledged.
| |
| 53 if (Profile::FromWebUI(web_ui())->IsOffTheRecord()) | |
|
Evan Stade
2014/08/19 17:49:13
would it be possible to not even create the Startu
Mike Lerman
2014/08/19 20:34:12
Done, removed this call here and added a check in
| |
| 54 return; | |
| 55 | |
| 51 web_ui()->RegisterMessageCallback("removeStartupPages", | 56 web_ui()->RegisterMessageCallback("removeStartupPages", |
| 52 base::Bind(&StartupPagesHandler::RemoveStartupPages, | 57 base::Bind(&StartupPagesHandler::RemoveStartupPages, |
| 53 base::Unretained(this))); | 58 base::Unretained(this))); |
| 54 web_ui()->RegisterMessageCallback("addStartupPage", | 59 web_ui()->RegisterMessageCallback("addStartupPage", |
| 55 base::Bind(&StartupPagesHandler::AddStartupPage, | 60 base::Bind(&StartupPagesHandler::AddStartupPage, |
| 56 base::Unretained(this))); | 61 base::Unretained(this))); |
| 57 web_ui()->RegisterMessageCallback("editStartupPage", | 62 web_ui()->RegisterMessageCallback("editStartupPage", |
| 58 base::Bind(&StartupPagesHandler::EditStartupPage, | 63 base::Bind(&StartupPagesHandler::EditStartupPage, |
| 59 base::Unretained(this))); | 64 base::Unretained(this))); |
| 60 web_ui()->RegisterMessageCallback("setStartupPagesToCurrentPages", | 65 web_ui()->RegisterMessageCallback("setStartupPagesToCurrentPages", |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 | 251 |
| 247 void StartupPagesHandler::OnResultChanged(bool default_match_changed) { | 252 void StartupPagesHandler::OnResultChanged(bool default_match_changed) { |
| 248 const AutocompleteResult& result = autocomplete_controller_->result(); | 253 const AutocompleteResult& result = autocomplete_controller_->result(); |
| 249 base::ListValue suggestions; | 254 base::ListValue suggestions; |
| 250 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 255 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
| 251 web_ui()->CallJavascriptFunction( | 256 web_ui()->CallJavascriptFunction( |
| 252 "StartupOverlay.updateAutocompleteSuggestions", suggestions); | 257 "StartupOverlay.updateAutocompleteSuggestions", suggestions); |
| 253 } | 258 } |
| 254 | 259 |
| 255 } // namespace options | 260 } // namespace options |
| OLD | NEW |