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