| 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/advanced_options_handler.h" | 19 #include "chrome/browser/dom_ui/advanced_options_handler.h" |
| 20 #include "chrome/browser/dom_ui/browser_options_handler.h" | 20 #include "chrome/browser/dom_ui/browser_options_handler.h" |
| 21 #include "chrome/browser/dom_ui/clear_browser_data_handler.h" |
| 21 #include "chrome/browser/dom_ui/content_settings_handler.h" | 22 #include "chrome/browser/dom_ui/content_settings_handler.h" |
| 22 #include "chrome/browser/dom_ui/core_options_handler.h" | 23 #include "chrome/browser/dom_ui/core_options_handler.h" |
| 24 #include "chrome/browser/dom_ui/font_settings_handler.h" |
| 23 #include "chrome/browser/dom_ui/personal_options_handler.h" | 25 #include "chrome/browser/dom_ui/personal_options_handler.h" |
| 24 #include "chrome/browser/metrics/user_metrics.h" | 26 #include "chrome/browser/metrics/user_metrics.h" |
| 25 #include "chrome/browser/pref_service.h" | 27 #include "chrome/browser/pref_service.h" |
| 26 #include "chrome/browser/profile.h" | 28 #include "chrome/browser/profile.h" |
| 27 #include "chrome/browser/tab_contents/tab_contents.h" | 29 #include "chrome/browser/tab_contents/tab_contents.h" |
| 28 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 30 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 29 #include "chrome/common/jstemplate_builder.h" | 31 #include "chrome/common/jstemplate_builder.h" |
| 30 #include "chrome/common/notification_service.h" | 32 #include "chrome/common/notification_service.h" |
| 31 #include "chrome/common/notification_type.h" | 33 #include "chrome/common/notification_type.h" |
| 32 #include "chrome/common/time_format.h" | 34 #include "chrome/common/time_format.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); | 124 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); |
| 123 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); | 125 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); |
| 124 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); | 126 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); |
| 125 AddOptionsPageUIHandler(localized_strings, | 127 AddOptionsPageUIHandler(localized_strings, |
| 126 new LanguageHangulOptionsHandler()); | 128 new LanguageHangulOptionsHandler()); |
| 127 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); | 129 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); |
| 128 AddOptionsPageUIHandler(localized_strings, | 130 AddOptionsPageUIHandler(localized_strings, |
| 129 new chromeos::AccountsOptionsHandler()); | 131 new chromeos::AccountsOptionsHandler()); |
| 130 #endif | 132 #endif |
| 131 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); | 133 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); |
| 134 AddOptionsPageUIHandler(localized_strings, new ClearBrowserDataHandler()); |
| 135 AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler()); |
| 132 | 136 |
| 133 // |localized_strings| ownership is taken over by this constructor. | 137 // |localized_strings| ownership is taken over by this constructor. |
| 134 OptionsUIHTMLSource* html_source = | 138 OptionsUIHTMLSource* html_source = |
| 135 new OptionsUIHTMLSource(localized_strings); | 139 new OptionsUIHTMLSource(localized_strings); |
| 136 | 140 |
| 137 // Set up the chrome://options/ source. | 141 // Set up the chrome://options/ source. |
| 138 ChromeThread::PostTask( | 142 ChromeThread::PostTask( |
| 139 ChromeThread::IO, FROM_HERE, | 143 ChromeThread::IO, FROM_HERE, |
| 140 NewRunnableMethod( | 144 NewRunnableMethod( |
| 141 Singleton<ChromeURLDataManager>::get(), | 145 Singleton<ChromeURLDataManager>::get(), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 157 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 161 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
| 158 } | 162 } |
| 159 } | 163 } |
| 160 | 164 |
| 161 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 165 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 162 OptionsPageUIHandler* handler) { | 166 OptionsPageUIHandler* handler) { |
| 163 DCHECK(handler); | 167 DCHECK(handler); |
| 164 handler->GetLocalizedValues(localized_strings); | 168 handler->GetLocalizedValues(localized_strings); |
| 165 AddMessageHandler(handler->Attach(this)); | 169 AddMessageHandler(handler->Attach(this)); |
| 166 } | 170 } |
| OLD | NEW |