| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 34 #include "net/base/escape.h" | 34 #include "net/base/escape.h" |
| 35 | 35 |
| 36 #include "grit/browser_resources.h" | 36 #include "grit/browser_resources.h" |
| 37 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
| 38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
| 39 #include "grit/locale_settings.h" | 39 #include "grit/locale_settings.h" |
| 40 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
| 41 | 41 |
| 42 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
| 43 #include "chrome/browser/chromeos/dom_ui/sync_options_handler.h" | 43 #include "chrome/browser/chromeos/dom_ui/accounts_options_handler.h" |
| 44 #include "chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h" |
| 44 #include "chrome/browser/chromeos/dom_ui/labs_handler.h" | 45 #include "chrome/browser/chromeos/dom_ui/labs_handler.h" |
| 45 #include "chrome/browser/chromeos/dom_ui/language_hangul_options_handler.h" | 46 #include "chrome/browser/chromeos/dom_ui/language_hangul_options_handler.h" |
| 46 #include "chrome/browser/chromeos/dom_ui/language_options_handler.h" | 47 #include "chrome/browser/chromeos/dom_ui/language_options_handler.h" |
| 48 #include "chrome/browser/chromeos/dom_ui/sync_options_handler.h" |
| 47 #include "chrome/browser/chromeos/dom_ui/system_options_handler.h" | 49 #include "chrome/browser/chromeos/dom_ui/system_options_handler.h" |
| 48 #endif | 50 #endif |
| 49 | 51 |
| 50 //////////////////////////////////////////////////////////////////////////////// | 52 //////////////////////////////////////////////////////////////////////////////// |
| 51 // | 53 // |
| 52 // OptionsUIHTMLSource | 54 // OptionsUIHTMLSource |
| 53 // | 55 // |
| 54 //////////////////////////////////////////////////////////////////////////////// | 56 //////////////////////////////////////////////////////////////////////////////// |
| 55 | 57 |
| 56 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings) | 58 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 100 |
| 99 //////////////////////////////////////////////////////////////////////////////// | 101 //////////////////////////////////////////////////////////////////////////////// |
| 100 // | 102 // |
| 101 // OptionsUI | 103 // OptionsUI |
| 102 // | 104 // |
| 103 //////////////////////////////////////////////////////////////////////////////// | 105 //////////////////////////////////////////////////////////////////////////////// |
| 104 | 106 |
| 105 OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) { | 107 OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) { |
| 106 DictionaryValue* localized_strings = new DictionaryValue(); | 108 DictionaryValue* localized_strings = new DictionaryValue(); |
| 107 | 109 |
| 110 #if defined(OS_CHROMEOS) |
| 111 AddOptionsPageUIHandler(localized_strings, |
| 112 new chromeos::CoreChromeOSOptionsHandler()); |
| 113 #else |
| 114 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); |
| 115 #endif |
| 116 |
| 108 // TODO(zelidrag): Add all other page handlers here as we implement them. | 117 // TODO(zelidrag): Add all other page handlers here as we implement them. |
| 109 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); | |
| 110 AddOptionsPageUIHandler(localized_strings, new BrowserOptionsHandler()); | 118 AddOptionsPageUIHandler(localized_strings, new BrowserOptionsHandler()); |
| 111 AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler()); | 119 AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler()); |
| 112 AddOptionsPageUIHandler(localized_strings, new AdvancedOptionsHandler()); | 120 AddOptionsPageUIHandler(localized_strings, new AdvancedOptionsHandler()); |
| 113 #if defined(OS_CHROMEOS) | 121 #if defined(OS_CHROMEOS) |
| 114 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); | 122 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); |
| 115 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); | 123 AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler()); |
| 116 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); | 124 AddOptionsPageUIHandler(localized_strings, new LabsHandler()); |
| 117 AddOptionsPageUIHandler(localized_strings, | 125 AddOptionsPageUIHandler(localized_strings, |
| 118 new LanguageHangulOptionsHandler()); | 126 new LanguageHangulOptionsHandler()); |
| 119 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); | 127 AddOptionsPageUIHandler(localized_strings, new LanguageOptionsHandler()); |
| 128 AddOptionsPageUIHandler(localized_strings, |
| 129 new chromeos::AccountsOptionsHandler()); |
| 120 #endif | 130 #endif |
| 121 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); | 131 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler()); |
| 122 | 132 |
| 123 // |localized_strings| ownership is taken over by this constructor. | 133 // |localized_strings| ownership is taken over by this constructor. |
| 124 OptionsUIHTMLSource* html_source = | 134 OptionsUIHTMLSource* html_source = |
| 125 new OptionsUIHTMLSource(localized_strings); | 135 new OptionsUIHTMLSource(localized_strings); |
| 126 | 136 |
| 127 // Set up the chrome://options/ source. | 137 // Set up the chrome://options/ source. |
| 128 ChromeThread::PostTask( | 138 ChromeThread::PostTask( |
| 129 ChromeThread::IO, FROM_HERE, | 139 ChromeThread::IO, FROM_HERE, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 147 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 157 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
| 148 } | 158 } |
| 149 } | 159 } |
| 150 | 160 |
| 151 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 161 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 152 OptionsPageUIHandler* handler) { | 162 OptionsPageUIHandler* handler) { |
| 153 DCHECK(handler); | 163 DCHECK(handler); |
| 154 handler->GetLocalizedValues(localized_strings); | 164 handler->GetLocalizedValues(localized_strings); |
| 155 AddMessageHandler(handler->Attach(this)); | 165 AddMessageHandler(handler->Attach(this)); |
| 156 } | 166 } |
| OLD | NEW |