| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/options_ui.h" | 5 #include "chrome/browser/dom_ui/options_ui.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/singleton.h" | 12 #include "base/singleton.h" |
| 13 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/thread.h" | 15 #include "base/thread.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/browser/chrome_thread.h" | 18 #include "chrome/browser/chrome_thread.h" |
| 19 #include "chrome/browser/dom_ui/add_startup_page_handler.h" |
| 19 #include "chrome/browser/dom_ui/advanced_options_handler.h" | 20 #include "chrome/browser/dom_ui/advanced_options_handler.h" |
| 20 #include "chrome/browser/dom_ui/browser_options_handler.h" | 21 #include "chrome/browser/dom_ui/browser_options_handler.h" |
| 21 #include "chrome/browser/dom_ui/clear_browser_data_handler.h" | 22 #include "chrome/browser/dom_ui/clear_browser_data_handler.h" |
| 22 #include "chrome/browser/dom_ui/content_settings_handler.h" | 23 #include "chrome/browser/dom_ui/content_settings_handler.h" |
| 23 #include "chrome/browser/dom_ui/core_options_handler.h" | 24 #include "chrome/browser/dom_ui/core_options_handler.h" |
| 24 #include "chrome/browser/dom_ui/font_settings_handler.h" | 25 #include "chrome/browser/dom_ui/font_settings_handler.h" |
| 25 #include "chrome/browser/dom_ui/personal_options_handler.h" | 26 #include "chrome/browser/dom_ui/personal_options_handler.h" |
| 26 #include "chrome/browser/dom_ui/sync_options_handler.h" | 27 #include "chrome/browser/dom_ui/sync_options_handler.h" |
| 27 #include "chrome/browser/metrics/user_metrics.h" | 28 #include "chrome/browser/metrics/user_metrics.h" |
| 28 #include "chrome/browser/pref_service.h" | 29 #include "chrome/browser/pref_service.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) { | 111 OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) { |
| 111 DictionaryValue* localized_strings = new DictionaryValue(); | 112 DictionaryValue* localized_strings = new DictionaryValue(); |
| 112 | 113 |
| 113 #if defined(OS_CHROMEOS) | 114 #if defined(OS_CHROMEOS) |
| 114 AddOptionsPageUIHandler(localized_strings, | 115 AddOptionsPageUIHandler(localized_strings, |
| 115 new chromeos::CoreChromeOSOptionsHandler()); | 116 new chromeos::CoreChromeOSOptionsHandler()); |
| 116 #else | 117 #else |
| 117 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); | 118 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); |
| 118 #endif | 119 #endif |
| 119 | 120 |
| 120 // TODO(zelidrag): Add all other page handlers here as we implement them. | 121 AddOptionsPageUIHandler(localized_strings, new AddStartupPageHandler()); |
| 122 AddOptionsPageUIHandler(localized_strings, new AdvancedOptionsHandler()); |
| 121 AddOptionsPageUIHandler(localized_strings, new BrowserOptionsHandler()); | 123 AddOptionsPageUIHandler(localized_strings, new BrowserOptionsHandler()); |
| 124 AddOptionsPageUIHandler(localized_strings, new ClearBrowserDataHandler()); |
| 125 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); |
| 126 AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler()); |
| 122 AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler()); | 127 AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler()); |
| 123 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); | 128 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); |
| 124 AddOptionsPageUIHandler(localized_strings, new AdvancedOptionsHandler()); | |
| 125 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); | |
| 126 #if defined(OS_CHROMEOS) | 129 #if defined(OS_CHROMEOS) |
| 127 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); | 130 AddOptionsPageUIHandler(localized_strings, |
| 131 new chromeos::AccountsOptionsHandler()); |
| 128 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); | 132 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); |
| 129 AddOptionsPageUIHandler(localized_strings, | 133 AddOptionsPageUIHandler(localized_strings, |
| 130 new LanguageChewingOptionsHandler()); | 134 new LanguageChewingOptionsHandler()); |
| 131 AddOptionsPageUIHandler(localized_strings, | 135 AddOptionsPageUIHandler(localized_strings, |
| 132 new LanguageHangulOptionsHandler()); | 136 new LanguageHangulOptionsHandler()); |
| 133 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); | 137 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); |
| 134 AddOptionsPageUIHandler(localized_strings, | 138 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); |
| 135 new chromeos::AccountsOptionsHandler()); | |
| 136 #endif | 139 #endif |
| 137 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); | |
| 138 AddOptionsPageUIHandler(localized_strings, new ClearBrowserDataHandler()); | |
| 139 AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler()); | |
| 140 | 140 |
| 141 // |localized_strings| ownership is taken over by this constructor. | 141 // |localized_strings| ownership is taken over by this constructor. |
| 142 OptionsUIHTMLSource* html_source = | 142 OptionsUIHTMLSource* html_source = |
| 143 new OptionsUIHTMLSource(localized_strings); | 143 new OptionsUIHTMLSource(localized_strings); |
| 144 | 144 |
| 145 // Set up the chrome://options/ source. | 145 // Set up the chrome://options/ source. |
| 146 ChromeThread::PostTask( | 146 ChromeThread::PostTask( |
| 147 ChromeThread::IO, FROM_HERE, | 147 ChromeThread::IO, FROM_HERE, |
| 148 NewRunnableMethod( | 148 NewRunnableMethod( |
| 149 Singleton<ChromeURLDataManager>::get(), | 149 Singleton<ChromeURLDataManager>::get(), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 165 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 165 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 169 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 170 OptionsPageUIHandler* handler) { | 170 OptionsPageUIHandler* handler) { |
| 171 DCHECK(handler); | 171 DCHECK(handler); |
| 172 handler->GetLocalizedValues(localized_strings); | 172 handler->GetLocalizedValues(localized_strings); |
| 173 AddMessageHandler(handler->Attach(this)); | 173 AddMessageHandler(handler->Attach(this)); |
| 174 } | 174 } |
| OLD | NEW |