| 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/clear_browser_data_handler.h" |
| 22 #include "chrome/browser/dom_ui/content_settings_handler.h" | 22 #include "chrome/browser/dom_ui/content_settings_handler.h" |
| 23 #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" | 24 #include "chrome/browser/dom_ui/font_settings_handler.h" |
| 25 #include "chrome/browser/dom_ui/personal_options_handler.h" | 25 #include "chrome/browser/dom_ui/personal_options_handler.h" |
| 26 #include "chrome/browser/dom_ui/sync_options_handler.h" |
| 26 #include "chrome/browser/metrics/user_metrics.h" | 27 #include "chrome/browser/metrics/user_metrics.h" |
| 27 #include "chrome/browser/pref_service.h" | 28 #include "chrome/browser/pref_service.h" |
| 28 #include "chrome/browser/profile.h" | 29 #include "chrome/browser/profile.h" |
| 29 #include "chrome/browser/tab_contents/tab_contents.h" | 30 #include "chrome/browser/tab_contents/tab_contents.h" |
| 30 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 31 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 31 #include "chrome/common/jstemplate_builder.h" | 32 #include "chrome/common/jstemplate_builder.h" |
| 32 #include "chrome/common/notification_service.h" | 33 #include "chrome/common/notification_service.h" |
| 33 #include "chrome/common/notification_type.h" | 34 #include "chrome/common/notification_type.h" |
| 34 #include "chrome/common/time_format.h" | 35 #include "chrome/common/time_format.h" |
| 35 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
| 36 #include "net/base/escape.h" | 37 #include "net/base/escape.h" |
| 37 | 38 |
| 38 #include "grit/browser_resources.h" | 39 #include "grit/browser_resources.h" |
| 39 #include "grit/chromium_strings.h" | 40 #include "grit/chromium_strings.h" |
| 40 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
| 41 #include "grit/locale_settings.h" | 42 #include "grit/locale_settings.h" |
| 42 #include "grit/theme_resources.h" | 43 #include "grit/theme_resources.h" |
| 43 | 44 |
| 44 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
| 45 #include "chrome/browser/chromeos/dom_ui/accounts_options_handler.h" | 46 #include "chrome/browser/chromeos/dom_ui/accounts_options_handler.h" |
| 46 #include "chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h" | 47 #include "chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h" |
| 47 #include "chrome/browser/chromeos/dom_ui/labs_handler.h" | 48 #include "chrome/browser/chromeos/dom_ui/labs_handler.h" |
| 48 #include "chrome/browser/chromeos/dom_ui/language_hangul_options_handler.h" | 49 #include "chrome/browser/chromeos/dom_ui/language_hangul_options_handler.h" |
| 49 #include "chrome/browser/chromeos/dom_ui/language_options_handler.h" | 50 #include "chrome/browser/chromeos/dom_ui/language_options_handler.h" |
| 50 #include "chrome/browser/chromeos/dom_ui/sync_options_handler.h" | |
| 51 #include "chrome/browser/chromeos/dom_ui/system_options_handler.h" | 51 #include "chrome/browser/chromeos/dom_ui/system_options_handler.h" |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 //////////////////////////////////////////////////////////////////////////////// | 54 //////////////////////////////////////////////////////////////////////////////// |
| 55 // | 55 // |
| 56 // OptionsUIHTMLSource | 56 // OptionsUIHTMLSource |
| 57 // | 57 // |
| 58 //////////////////////////////////////////////////////////////////////////////// | 58 //////////////////////////////////////////////////////////////////////////////// |
| 59 | 59 |
| 60 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings) | 60 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
| 113 AddOptionsPageUIHandler(localized_strings, | 113 AddOptionsPageUIHandler(localized_strings, |
| 114 new chromeos::CoreChromeOSOptionsHandler()); | 114 new chromeos::CoreChromeOSOptionsHandler()); |
| 115 #else | 115 #else |
| 116 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); | 116 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); |
| 117 #endif | 117 #endif |
| 118 | 118 |
| 119 // TODO(zelidrag): Add all other page handlers here as we implement them. | 119 // TODO(zelidrag): Add all other page handlers here as we implement them. |
| 120 AddOptionsPageUIHandler(localized_strings, new BrowserOptionsHandler()); | 120 AddOptionsPageUIHandler(localized_strings, new BrowserOptionsHandler()); |
| 121 AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler()); | 121 AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler()); |
| 122 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); |
| 122 AddOptionsPageUIHandler(localized_strings, new AdvancedOptionsHandler()); | 123 AddOptionsPageUIHandler(localized_strings, new AdvancedOptionsHandler()); |
| 124 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); |
| 123 #if defined(OS_CHROMEOS) | 125 #if defined(OS_CHROMEOS) |
| 124 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); | 126 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); |
| 125 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); | |
| 126 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); | 127 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); |
| 127 AddOptionsPageUIHandler(localized_strings, | 128 AddOptionsPageUIHandler(localized_strings, |
| 128 new LanguageHangulOptionsHandler()); | 129 new LanguageHangulOptionsHandler()); |
| 129 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); | 130 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); |
| 130 AddOptionsPageUIHandler(localized_strings, | 131 AddOptionsPageUIHandler(localized_strings, |
| 131 new chromeos::AccountsOptionsHandler()); | 132 new chromeos::AccountsOptionsHandler()); |
| 132 #endif | 133 #endif |
| 133 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); | 134 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); |
| 134 AddOptionsPageUIHandler(localized_strings, new ClearBrowserDataHandler()); | 135 AddOptionsPageUIHandler(localized_strings, new ClearBrowserDataHandler()); |
| 135 AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler()); | 136 AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 161 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 162 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
| 162 } | 163 } |
| 163 } | 164 } |
| 164 | 165 |
| 165 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 166 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 166 OptionsPageUIHandler* handler) { | 167 OptionsPageUIHandler* handler) { |
| 167 DCHECK(handler); | 168 DCHECK(handler); |
| 168 handler->GetLocalizedValues(localized_strings); | 169 handler->GetLocalizedValues(localized_strings); |
| 169 AddMessageHandler(handler->Attach(this)); | 170 AddMessageHandler(handler->Attach(this)); |
| 170 } | 171 } |
| OLD | NEW |