| 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/options_ui2.h" | 5 #include "chrome/browser/ui/webui/options2/options_ui2.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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/string_piece.h" | 15 #include "base/string_piece.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "base/time.h" | 18 #include "base/time.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete.h" | 20 #include "chrome/browser/autocomplete/autocomplete.h" |
| 21 #include "chrome/browser/autocomplete/autocomplete_match.h" | 21 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 22 #include "chrome/browser/browser_about_handler.h" | 22 #include "chrome/browser/browser_about_handler.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 25 #include "chrome/browser/ui/webui/options2/autofill_options_handler2.h" | 26 #include "chrome/browser/ui/webui/options2/autofill_options_handler2.h" |
| 26 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h" | 27 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h" |
| 27 #include "chrome/browser/ui/webui/options2/clear_browser_data_handler2.h" | 28 #include "chrome/browser/ui/webui/options2/clear_browser_data_handler2.h" |
| 28 #include "chrome/browser/ui/webui/options2/content_settings_handler2.h" | 29 #include "chrome/browser/ui/webui/options2/content_settings_handler2.h" |
| 29 #include "chrome/browser/ui/webui/options2/cookies_view_handler2.h" | 30 #include "chrome/browser/ui/webui/options2/cookies_view_handler2.h" |
| 30 #include "chrome/browser/ui/webui/options2/core_options_handler2.h" | 31 #include "chrome/browser/ui/webui/options2/core_options_handler2.h" |
| 31 #include "chrome/browser/ui/webui/options2/font_settings_handler2.h" | 32 #include "chrome/browser/ui/webui/options2/font_settings_handler2.h" |
| 32 #include "chrome/browser/ui/webui/options2/handler_options_handler2.h" | 33 #include "chrome/browser/ui/webui/options2/handler_options_handler2.h" |
| 33 #include "chrome/browser/ui/webui/options2/home_page_overlay_handler2.h" | 34 #include "chrome/browser/ui/webui/options2/home_page_overlay_handler2.h" |
| 34 #include "chrome/browser/ui/webui/options2/import_data_handler2.h" | 35 #include "chrome/browser/ui/webui/options2/import_data_handler2.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 AddOptionsPageUIHandler(localized_strings, new CertificateManagerHandler()); | 294 AddOptionsPageUIHandler(localized_strings, new CertificateManagerHandler()); |
| 294 #endif | 295 #endif |
| 295 AddOptionsPageUIHandler(localized_strings, new HandlerOptionsHandler()); | 296 AddOptionsPageUIHandler(localized_strings, new HandlerOptionsHandler()); |
| 296 | 297 |
| 297 // |localized_strings| ownership is taken over by this constructor. | 298 // |localized_strings| ownership is taken over by this constructor. |
| 298 OptionsUIHTMLSource* html_source = | 299 OptionsUIHTMLSource* html_source = |
| 299 new OptionsUIHTMLSource(localized_strings); | 300 new OptionsUIHTMLSource(localized_strings); |
| 300 | 301 |
| 301 // Set up the chrome://settings-frame/ source. | 302 // Set up the chrome://settings-frame/ source. |
| 302 Profile* profile = Profile::FromWebUI(web_ui); | 303 Profile* profile = Profile::FromWebUI(web_ui); |
| 303 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 304 ChromeURLDataManager::AddDataSource(profile, html_source); |
| 304 | 305 |
| 305 // Set up the chrome://theme/ source. | 306 // Set up the chrome://theme/ source. |
| 306 ThemeSource* theme = new ThemeSource(profile); | 307 ThemeSource* theme = new ThemeSource(profile); |
| 307 profile->GetChromeURLDataManager()->AddDataSource(theme); | 308 ChromeURLDataManager::AddDataSource(profile, theme); |
| 308 | 309 |
| 309 #if defined(OS_CHROMEOS) | 310 #if defined(OS_CHROMEOS) |
| 310 // Set up the chrome://userimage/ source. | 311 // Set up the chrome://userimage/ source. |
| 311 chromeos::options2::UserImageSource* user_image_source = | 312 chromeos::options2::UserImageSource* user_image_source = |
| 312 new chromeos::options2::UserImageSource(); | 313 new chromeos::options2::UserImageSource(); |
| 313 profile->GetChromeURLDataManager()->AddDataSource(user_image_source); | 314 ChromeURLDataManager::AddDataSource(profile, user_image_source); |
| 315 |
| 314 // Set up the chrome://wallpaper/ source. | 316 // Set up the chrome://wallpaper/ source. |
| 315 chromeos::options2::WallpaperThumbnailSource* wallpaper_thumbnail_source = | 317 chromeos::options2::WallpaperThumbnailSource* wallpaper_thumbnail_source = |
| 316 new chromeos::options2::WallpaperThumbnailSource(); | 318 new chromeos::options2::WallpaperThumbnailSource(); |
| 317 profile->GetChromeURLDataManager()-> | 319 ChromeURLDataManager::AddDataSource(profile, wallpaper_thumbnail_source); |
| 318 AddDataSource(wallpaper_thumbnail_source); | |
| 319 | 320 |
| 320 pointer_device_observer_.reset( | 321 pointer_device_observer_.reset( |
| 321 new chromeos::system::PointerDeviceObserver()); | 322 new chromeos::system::PointerDeviceObserver()); |
| 322 pointer_device_observer_->AddObserver(browser_options_handler); | 323 pointer_device_observer_->AddObserver(browser_options_handler); |
| 323 pointer_device_observer_->AddObserver(pointer_handler); | 324 pointer_device_observer_->AddObserver(pointer_handler); |
| 324 #endif | 325 #endif |
| 325 } | 326 } |
| 326 | 327 |
| 327 OptionsUI::~OptionsUI() { | 328 OptionsUI::~OptionsUI() { |
| 328 // Uninitialize all registered handlers. Deleted by WebUIImpl. | 329 // Uninitialize all registered handlers. Deleted by WebUIImpl. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); | 421 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); |
| 421 #else | 422 #else |
| 422 command_line_string = | 423 command_line_string = |
| 423 CommandLine::ForCurrentProcess()->GetCommandLineString(); | 424 CommandLine::ForCurrentProcess()->GetCommandLineString(); |
| 424 #endif | 425 #endif |
| 425 | 426 |
| 426 render_view_host->SetWebUIProperty("commandLineString", command_line_string); | 427 render_view_host->SetWebUIProperty("commandLineString", command_line_string); |
| 427 } | 428 } |
| 428 | 429 |
| 429 } // namespace options2 | 430 } // namespace options2 |
| OLD | NEW |