| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 AddOptionsPageUIHandler(localized_strings, pointer_handler); | 279 AddOptionsPageUIHandler(localized_strings, pointer_handler); |
| 285 | 280 |
| 286 AddOptionsPageUIHandler(localized_strings, | 281 AddOptionsPageUIHandler(localized_strings, |
| 287 new chromeos::options::ProxyHandler()); | 282 new chromeos::options::ProxyHandler()); |
| 288 AddOptionsPageUIHandler( | 283 AddOptionsPageUIHandler( |
| 289 localized_strings, | 284 localized_strings, |
| 290 new chromeos::options::ChangePictureOptionsHandler()); | 285 new chromeos::options::ChangePictureOptionsHandler()); |
| 291 AddOptionsPageUIHandler(localized_strings, | 286 AddOptionsPageUIHandler(localized_strings, |
| 292 new chromeos::options::StatsOptionsHandler()); | 287 new chromeos::options::StatsOptionsHandler()); |
| 293 #endif | 288 #endif |
| 294 #if defined(OS_CHROMEOS) && defined(USE_ASH) | |
| 295 AddOptionsPageUIHandler( | |
| 296 localized_strings, | |
| 297 new chromeos::options::SetWallpaperOptionsHandler()); | |
| 298 #endif | |
| 299 #if defined(USE_NSS) | 289 #if defined(USE_NSS) |
| 300 AddOptionsPageUIHandler(localized_strings, new CertificateManagerHandler()); | 290 AddOptionsPageUIHandler(localized_strings, new CertificateManagerHandler()); |
| 301 #endif | 291 #endif |
| 302 AddOptionsPageUIHandler(localized_strings, new HandlerOptionsHandler()); | 292 AddOptionsPageUIHandler(localized_strings, new HandlerOptionsHandler()); |
| 303 | 293 |
| 304 // |localized_strings| ownership is taken over by this constructor. | 294 // |localized_strings| ownership is taken over by this constructor. |
| 305 OptionsUIHTMLSource* html_source = | 295 OptionsUIHTMLSource* html_source = |
| 306 new OptionsUIHTMLSource(localized_strings); | 296 new OptionsUIHTMLSource(localized_strings); |
| 307 | 297 |
| 308 // Set up the chrome://settings-frame/ source. | 298 // Set up the chrome://settings-frame/ source. |
| 309 Profile* profile = Profile::FromWebUI(web_ui); | 299 Profile* profile = Profile::FromWebUI(web_ui); |
| 310 ChromeURLDataManager::AddDataSource(profile, html_source); | 300 ChromeURLDataManager::AddDataSource(profile, html_source); |
| 311 | 301 |
| 312 // Set up the chrome://theme/ source. | 302 // Set up the chrome://theme/ source. |
| 313 ThemeSource* theme = new ThemeSource(profile); | 303 ThemeSource* theme = new ThemeSource(profile); |
| 314 ChromeURLDataManager::AddDataSource(profile, theme); | 304 ChromeURLDataManager::AddDataSource(profile, theme); |
| 315 | 305 |
| 316 #if defined(OS_CHROMEOS) | 306 #if defined(OS_CHROMEOS) |
| 317 // Set up the chrome://userimage/ source. | 307 // Set up the chrome://userimage/ source. |
| 318 chromeos::options::UserImageSource* user_image_source = | 308 chromeos::options::UserImageSource* user_image_source = |
| 319 new chromeos::options::UserImageSource(); | 309 new chromeos::options::UserImageSource(); |
| 320 ChromeURLDataManager::AddDataSource(profile, user_image_source); | 310 ChromeURLDataManager::AddDataSource(profile, user_image_source); |
| 321 | 311 |
| 322 // Set up the chrome://wallpaper-thumb/ source. | |
| 323 chromeos::options::WallpaperThumbnailSource* wallpaper_thumbnail_source = | |
| 324 new chromeos::options::WallpaperThumbnailSource(); | |
| 325 ChromeURLDataManager::AddDataSource(profile, wallpaper_thumbnail_source); | |
| 326 | |
| 327 pointer_device_observer_.reset( | 312 pointer_device_observer_.reset( |
| 328 new chromeos::system::PointerDeviceObserver()); | 313 new chromeos::system::PointerDeviceObserver()); |
| 329 pointer_device_observer_->AddObserver(browser_options_handler); | 314 pointer_device_observer_->AddObserver(browser_options_handler); |
| 330 pointer_device_observer_->AddObserver(pointer_handler); | 315 pointer_device_observer_->AddObserver(pointer_handler); |
| 331 #endif | 316 #endif |
| 332 } | 317 } |
| 333 | 318 |
| 334 OptionsUI::~OptionsUI() { | 319 OptionsUI::~OptionsUI() { |
| 335 // Uninitialize all registered handlers. Deleted by WebUIImpl. | 320 // Uninitialize all registered handlers. Deleted by WebUIImpl. |
| 336 for (size_t i = 0; i < handlers_.size(); ++i) | 321 for (size_t i = 0; i < handlers_.size(); ++i) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 // Add only if handler's service is enabled. | 395 // Add only if handler's service is enabled. |
| 411 if (handler->IsEnabled()) { | 396 if (handler->IsEnabled()) { |
| 412 // Add handler to the list and also pass the ownership. | 397 // Add handler to the list and also pass the ownership. |
| 413 web_ui()->AddMessageHandler(handler.release()); | 398 web_ui()->AddMessageHandler(handler.release()); |
| 414 handler_raw->GetLocalizedValues(localized_strings); | 399 handler_raw->GetLocalizedValues(localized_strings); |
| 415 handlers_.push_back(handler_raw); | 400 handlers_.push_back(handler_raw); |
| 416 } | 401 } |
| 417 } | 402 } |
| 418 | 403 |
| 419 } // namespace options | 404 } // namespace options |
| OLD | NEW |