| 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/content_settings_handler.h" | 21 #include "chrome/browser/dom_ui/content_settings_handler.h" |
| 22 #include "chrome/browser/dom_ui/core_options_handler.h" | 22 #include "chrome/browser/dom_ui/core_options_handler.h" |
| 23 #include "chrome/browser/dom_ui/personal_options_handler.h" | 23 #include "chrome/browser/dom_ui/personal_options_handler.h" |
| 24 #include "chrome/browser/dom_ui/sync_options_handler.h" | |
| 25 #include "chrome/browser/metrics/user_metrics.h" | 24 #include "chrome/browser/metrics/user_metrics.h" |
| 26 #include "chrome/browser/pref_service.h" | 25 #include "chrome/browser/pref_service.h" |
| 27 #include "chrome/browser/profile.h" | 26 #include "chrome/browser/profile.h" |
| 28 #include "chrome/browser/tab_contents/tab_contents.h" | 27 #include "chrome/browser/tab_contents/tab_contents.h" |
| 29 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 28 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 30 #include "chrome/common/jstemplate_builder.h" | 29 #include "chrome/common/jstemplate_builder.h" |
| 31 #include "chrome/common/notification_service.h" | 30 #include "chrome/common/notification_service.h" |
| 32 #include "chrome/common/notification_type.h" | 31 #include "chrome/common/notification_type.h" |
| 33 #include "chrome/common/time_format.h" | 32 #include "chrome/common/time_format.h" |
| 34 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 #if defined(OS_CHROMEOS) | 109 #if defined(OS_CHROMEOS) |
| 111 AddOptionsPageUIHandler(localized_strings, | 110 AddOptionsPageUIHandler(localized_strings, |
| 112 new chromeos::CoreChromeOSOptionsHandler()); | 111 new chromeos::CoreChromeOSOptionsHandler()); |
| 113 #else | 112 #else |
| 114 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); | 113 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); |
| 115 #endif | 114 #endif |
| 116 | 115 |
| 117 // TODO(zelidrag): Add all other page handlers here as we implement them. | 116 // TODO(zelidrag): Add all other page handlers here as we implement them. |
| 118 AddOptionsPageUIHandler(localized_strings, new BrowserOptionsHandler()); | 117 AddOptionsPageUIHandler(localized_strings, new BrowserOptionsHandler()); |
| 119 AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler()); | 118 AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler()); |
| 120 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); | |
| 121 AddOptionsPageUIHandler(localized_strings, new AdvancedOptionsHandler()); | 119 AddOptionsPageUIHandler(localized_strings, new AdvancedOptionsHandler()); |
| 122 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); | |
| 123 #if defined(OS_CHROMEOS) | 120 #if defined(OS_CHROMEOS) |
| 124 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); | 121 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); |
| 122 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); |
| 125 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); | 123 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); |
| 126 AddOptionsPageUIHandler(localized_strings, | 124 AddOptionsPageUIHandler(localized_strings, |
| 127 new LanguageHangulOptionsHandler()); | 125 new LanguageHangulOptionsHandler()); |
| 128 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); | 126 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); |
| 129 AddOptionsPageUIHandler(localized_strings, | 127 AddOptionsPageUIHandler(localized_strings, |
| 130 new chromeos::AccountsOptionsHandler()); | 128 new chromeos::AccountsOptionsHandler()); |
| 131 #endif | 129 #endif |
| 130 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); |
| 132 | 131 |
| 133 // |localized_strings| ownership is taken over by this constructor. | 132 // |localized_strings| ownership is taken over by this constructor. |
| 134 OptionsUIHTMLSource* html_source = | 133 OptionsUIHTMLSource* html_source = |
| 135 new OptionsUIHTMLSource(localized_strings); | 134 new OptionsUIHTMLSource(localized_strings); |
| 136 | 135 |
| 137 // Set up the chrome://options/ source. | 136 // Set up the chrome://options/ source. |
| 138 ChromeThread::PostTask( | 137 ChromeThread::PostTask( |
| 139 ChromeThread::IO, FROM_HERE, | 138 ChromeThread::IO, FROM_HERE, |
| 140 NewRunnableMethod( | 139 NewRunnableMethod( |
| 141 Singleton<ChromeURLDataManager>::get(), | 140 Singleton<ChromeURLDataManager>::get(), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 157 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 156 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
| 158 } | 157 } |
| 159 } | 158 } |
| 160 | 159 |
| 161 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 160 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 162 OptionsPageUIHandler* handler) { | 161 OptionsPageUIHandler* handler) { |
| 163 DCHECK(handler); | 162 DCHECK(handler); |
| 164 handler->GetLocalizedValues(localized_strings); | 163 handler->GetLocalizedValues(localized_strings); |
| 165 AddMessageHandler(handler->Attach(this)); | 164 AddMessageHandler(handler->Attach(this)); |
| 166 } | 165 } |
| OLD | NEW |