| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler.h" | 70 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler.h" |
| 71 #include "chrome/browser/ui/webui/options/chromeos/keyboard_handler.h" | 71 #include "chrome/browser/ui/webui/options/chromeos/keyboard_handler.h" |
| 72 #include "chrome/browser/ui/webui/options/chromeos/language_chewing_handler.h" | 72 #include "chrome/browser/ui/webui/options/chromeos/language_chewing_handler.h" |
| 73 #include "chrome/browser/ui/webui/options/chromeos/language_hangul_handler.h" | 73 #include "chrome/browser/ui/webui/options/chromeos/language_hangul_handler.h" |
| 74 #include "chrome/browser/ui/webui/options/chromeos/language_mozc_handler.h" | 74 #include "chrome/browser/ui/webui/options/chromeos/language_mozc_handler.h" |
| 75 #include "chrome/browser/ui/webui/options/chromeos/language_pinyin_handler.h" | 75 #include "chrome/browser/ui/webui/options/chromeos/language_pinyin_handler.h" |
| 76 #include "chrome/browser/ui/webui/options/chromeos/pointer_handler.h" | 76 #include "chrome/browser/ui/webui/options/chromeos/pointer_handler.h" |
| 77 #include "chrome/browser/ui/webui/options/chromeos/proxy_handler.h" | 77 #include "chrome/browser/ui/webui/options/chromeos/proxy_handler.h" |
| 78 #include "chrome/browser/ui/webui/options/chromeos/stats_options_handler.h" | 78 #include "chrome/browser/ui/webui/options/chromeos/stats_options_handler.h" |
| 79 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" | 79 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" |
| 80 #include "chrome/browser/ui/webui/options/chromeos/wallpaper_thumbnail_source.h" | |
| 81 #endif | |
| 82 | |
| 83 #if defined(OS_CHROMEOS) && defined(USE_ASH) | |
| 84 #include "chrome/browser/ui/webui/options/chromeos/set_wallpaper_options_handler
.h" | |
| 85 #endif | 80 #endif |
| 86 | 81 |
| 87 #if defined(USE_NSS) | 82 #if defined(USE_NSS) |
| 88 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h" | 83 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h" |
| 89 #endif | 84 #endif |
| 90 | 85 |
| 91 using content::RenderViewHost; | 86 using content::RenderViewHost; |
| 92 | 87 |
| 93 namespace { | 88 namespace { |
| 94 | 89 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 AddOptionsPageUIHandler(localized_strings, pointer_handler); | 280 AddOptionsPageUIHandler(localized_strings, pointer_handler); |
| 286 | 281 |
| 287 AddOptionsPageUIHandler(localized_strings, | 282 AddOptionsPageUIHandler(localized_strings, |
| 288 new chromeos::options::ProxyHandler()); | 283 new chromeos::options::ProxyHandler()); |
| 289 AddOptionsPageUIHandler( | 284 AddOptionsPageUIHandler( |
| 290 localized_strings, | 285 localized_strings, |
| 291 new chromeos::options::ChangePictureOptionsHandler()); | 286 new chromeos::options::ChangePictureOptionsHandler()); |
| 292 AddOptionsPageUIHandler(localized_strings, | 287 AddOptionsPageUIHandler(localized_strings, |
| 293 new chromeos::options::StatsOptionsHandler()); | 288 new chromeos::options::StatsOptionsHandler()); |
| 294 #endif | 289 #endif |
| 295 #if defined(OS_CHROMEOS) && defined(USE_ASH) | |
| 296 AddOptionsPageUIHandler( | |
| 297 localized_strings, | |
| 298 new chromeos::options::SetWallpaperOptionsHandler()); | |
| 299 #endif | |
| 300 #if defined(USE_NSS) | 290 #if defined(USE_NSS) |
| 301 AddOptionsPageUIHandler(localized_strings, new CertificateManagerHandler()); | 291 AddOptionsPageUIHandler(localized_strings, new CertificateManagerHandler()); |
| 302 #endif | 292 #endif |
| 303 AddOptionsPageUIHandler(localized_strings, new HandlerOptionsHandler()); | 293 AddOptionsPageUIHandler(localized_strings, new HandlerOptionsHandler()); |
| 304 | 294 |
| 305 // |localized_strings| ownership is taken over by this constructor. | 295 // |localized_strings| ownership is taken over by this constructor. |
| 306 OptionsUIHTMLSource* html_source = | 296 OptionsUIHTMLSource* html_source = |
| 307 new OptionsUIHTMLSource(localized_strings); | 297 new OptionsUIHTMLSource(localized_strings); |
| 308 | 298 |
| 309 // Set up the chrome://settings-frame/ source. | 299 // Set up the chrome://settings-frame/ source. |
| 310 Profile* profile = Profile::FromWebUI(web_ui); | 300 Profile* profile = Profile::FromWebUI(web_ui); |
| 311 ChromeURLDataManager::AddDataSource(profile, html_source); | 301 ChromeURLDataManager::AddDataSource(profile, html_source); |
| 312 | 302 |
| 313 // Set up the chrome://theme/ source. | 303 // Set up the chrome://theme/ source. |
| 314 ThemeSource* theme = new ThemeSource(profile); | 304 ThemeSource* theme = new ThemeSource(profile); |
| 315 ChromeURLDataManager::AddDataSource(profile, theme); | 305 ChromeURLDataManager::AddDataSource(profile, theme); |
| 316 | 306 |
| 317 #if defined(OS_CHROMEOS) | 307 #if defined(OS_CHROMEOS) |
| 318 // Set up the chrome://userimage/ source. | 308 // Set up the chrome://userimage/ source. |
| 319 chromeos::options::UserImageSource* user_image_source = | 309 chromeos::options::UserImageSource* user_image_source = |
| 320 new chromeos::options::UserImageSource(); | 310 new chromeos::options::UserImageSource(); |
| 321 ChromeURLDataManager::AddDataSource(profile, user_image_source); | 311 ChromeURLDataManager::AddDataSource(profile, user_image_source); |
| 322 | 312 |
| 323 // Set up the chrome://wallpaper-thumb/ source. | |
| 324 chromeos::options::WallpaperThumbnailSource* wallpaper_thumbnail_source = | |
| 325 new chromeos::options::WallpaperThumbnailSource(); | |
| 326 ChromeURLDataManager::AddDataSource(profile, wallpaper_thumbnail_source); | |
| 327 | |
| 328 pointer_device_observer_.reset( | 313 pointer_device_observer_.reset( |
| 329 new chromeos::system::PointerDeviceObserver()); | 314 new chromeos::system::PointerDeviceObserver()); |
| 330 pointer_device_observer_->AddObserver(browser_options_handler); | 315 pointer_device_observer_->AddObserver(browser_options_handler); |
| 331 pointer_device_observer_->AddObserver(pointer_handler); | 316 pointer_device_observer_->AddObserver(pointer_handler); |
| 332 #endif | 317 #endif |
| 333 } | 318 } |
| 334 | 319 |
| 335 OptionsUI::~OptionsUI() { | 320 OptionsUI::~OptionsUI() { |
| 336 // Uninitialize all registered handlers. Deleted by WebUIImpl. | 321 // Uninitialize all registered handlers. Deleted by WebUIImpl. |
| 337 for (size_t i = 0; i < handlers_.size(); ++i) | 322 for (size_t i = 0; i < handlers_.size(); ++i) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // Add only if handler's service is enabled. | 396 // Add only if handler's service is enabled. |
| 412 if (handler->IsEnabled()) { | 397 if (handler->IsEnabled()) { |
| 413 // Add handler to the list and also pass the ownership. | 398 // Add handler to the list and also pass the ownership. |
| 414 web_ui()->AddMessageHandler(handler.release()); | 399 web_ui()->AddMessageHandler(handler.release()); |
| 415 handler_raw->GetLocalizedValues(localized_strings); | 400 handler_raw->GetLocalizedValues(localized_strings); |
| 416 handlers_.push_back(handler_raw); | 401 handlers_.push_back(handler_raw); |
| 417 } | 402 } |
| 418 } | 403 } |
| 419 | 404 |
| 420 } // namespace options | 405 } // namespace options |
| OLD | NEW |