| 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/options_ui.h" | 5 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 200 } |
| 201 | 201 |
| 202 OptionsUIHTMLSource::~OptionsUIHTMLSource() {} | 202 OptionsUIHTMLSource::~OptionsUIHTMLSource() {} |
| 203 | 203 |
| 204 //////////////////////////////////////////////////////////////////////////////// | 204 //////////////////////////////////////////////////////////////////////////////// |
| 205 // | 205 // |
| 206 // OptionsPageUIHandler | 206 // OptionsPageUIHandler |
| 207 // | 207 // |
| 208 //////////////////////////////////////////////////////////////////////////////// | 208 //////////////////////////////////////////////////////////////////////////////// |
| 209 | 209 |
| 210 const char OptionsPageUIHandler::kSettingsAppKey[] = "settingsApp"; | |
| 211 | |
| 212 OptionsPageUIHandler::OptionsPageUIHandler() { | 210 OptionsPageUIHandler::OptionsPageUIHandler() { |
| 213 } | 211 } |
| 214 | 212 |
| 215 OptionsPageUIHandler::~OptionsPageUIHandler() { | 213 OptionsPageUIHandler::~OptionsPageUIHandler() { |
| 216 } | 214 } |
| 217 | 215 |
| 218 bool OptionsPageUIHandler::IsEnabled() { | 216 bool OptionsPageUIHandler::IsEnabled() { |
| 219 return true; | 217 return true; |
| 220 } | 218 } |
| 221 | 219 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // | 251 // |
| 254 // OptionsUI | 252 // OptionsUI |
| 255 // | 253 // |
| 256 //////////////////////////////////////////////////////////////////////////////// | 254 //////////////////////////////////////////////////////////////////////////////// |
| 257 | 255 |
| 258 OptionsUI::OptionsUI(content::WebUI* web_ui) | 256 OptionsUI::OptionsUI(content::WebUI* web_ui) |
| 259 : WebUIController(web_ui), | 257 : WebUIController(web_ui), |
| 260 WebContentsObserver(web_ui->GetWebContents()), | 258 WebContentsObserver(web_ui->GetWebContents()), |
| 261 initialized_handlers_(false) { | 259 initialized_handlers_(false) { |
| 262 base::DictionaryValue* localized_strings = new base::DictionaryValue(); | 260 base::DictionaryValue* localized_strings = new base::DictionaryValue(); |
| 263 localized_strings->Set(OptionsPageUIHandler::kSettingsAppKey, | |
| 264 new base::DictionaryValue()); | |
| 265 | |
| 266 CoreOptionsHandler* core_handler; | 261 CoreOptionsHandler* core_handler; |
| 267 #if defined(OS_CHROMEOS) | 262 #if defined(OS_CHROMEOS) |
| 268 core_handler = new chromeos::options::CoreChromeOSOptionsHandler(); | 263 core_handler = new chromeos::options::CoreChromeOSOptionsHandler(); |
| 269 #else | 264 #else |
| 270 core_handler = new CoreOptionsHandler(); | 265 core_handler = new CoreOptionsHandler(); |
| 271 #endif | 266 #endif |
| 272 core_handler->set_handlers_host(this); | 267 core_handler->set_handlers_host(this); |
| 273 AddOptionsPageUIHandler(localized_strings, core_handler); | 268 AddOptionsPageUIHandler(localized_strings, core_handler); |
| 274 | 269 |
| 275 AddOptionsPageUIHandler(localized_strings, new AutofillOptionsHandler()); | 270 AddOptionsPageUIHandler(localized_strings, new AutofillOptionsHandler()); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // Add only if handler's service is enabled. | 484 // Add only if handler's service is enabled. |
| 490 if (handler->IsEnabled()) { | 485 if (handler->IsEnabled()) { |
| 491 // Add handler to the list and also pass the ownership. | 486 // Add handler to the list and also pass the ownership. |
| 492 web_ui()->AddMessageHandler(handler.release()); | 487 web_ui()->AddMessageHandler(handler.release()); |
| 493 handler_raw->GetLocalizedValues(localized_strings); | 488 handler_raw->GetLocalizedValues(localized_strings); |
| 494 handlers_.push_back(handler_raw); | 489 handlers_.push_back(handler_raw); |
| 495 } | 490 } |
| 496 } | 491 } |
| 497 | 492 |
| 498 } // namespace options | 493 } // namespace options |
| OLD | NEW |