OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options2/options_ui2.h" | 5 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/string_piece.h" | 14 #include "base/string_piece.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "chrome/browser/browser_about_handler.h" | 19 #include "chrome/browser/browser_about_handler.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/ui/webui/options/options_sync_setup_handler.h" |
| 23 #include "chrome/browser/ui/webui/options/stop_syncing_handler.h" |
22 #include "chrome/browser/ui/webui/options2/advanced_options_handler2.h" | 24 #include "chrome/browser/ui/webui/options2/advanced_options_handler2.h" |
23 #include "chrome/browser/ui/webui/options2/autofill_options_handler2.h" | 25 #include "chrome/browser/ui/webui/options2/autofill_options_handler2.h" |
24 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h" | 26 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h" |
25 #include "chrome/browser/ui/webui/options2/clear_browser_data_handler2.h" | 27 #include "chrome/browser/ui/webui/options2/clear_browser_data_handler2.h" |
26 #include "chrome/browser/ui/webui/options2/content_settings_handler2.h" | 28 #include "chrome/browser/ui/webui/options2/content_settings_handler2.h" |
27 #include "chrome/browser/ui/webui/options2/cookies_view_handler2.h" | 29 #include "chrome/browser/ui/webui/options2/cookies_view_handler2.h" |
28 #include "chrome/browser/ui/webui/options2/core_options_handler2.h" | 30 #include "chrome/browser/ui/webui/options2/core_options_handler2.h" |
29 #include "chrome/browser/ui/webui/options2/font_settings_handler2.h" | 31 #include "chrome/browser/ui/webui/options2/font_settings_handler2.h" |
30 #include "chrome/browser/ui/webui/options2/handler_options_handler2.h" | 32 #include "chrome/browser/ui/webui/options2/handler_options_handler2.h" |
31 #include "chrome/browser/ui/webui/options2/import_data_handler2.h" | 33 #include "chrome/browser/ui/webui/options2/import_data_handler2.h" |
32 #include "chrome/browser/ui/webui/options2/language_options_handler2.h" | 34 #include "chrome/browser/ui/webui/options2/language_options_handler2.h" |
33 #include "chrome/browser/ui/webui/options2/manage_profile_handler2.h" | 35 #include "chrome/browser/ui/webui/options2/manage_profile_handler2.h" |
34 #include "chrome/browser/ui/webui/options2/options_sync_setup_handler2.h" | |
35 #include "chrome/browser/ui/webui/options2/password_manager_handler2.h" | 36 #include "chrome/browser/ui/webui/options2/password_manager_handler2.h" |
36 #include "chrome/browser/ui/webui/options2/search_engine_manager_handler2.h" | 37 #include "chrome/browser/ui/webui/options2/search_engine_manager_handler2.h" |
37 #include "chrome/browser/ui/webui/options2/startup_pages_handler2.h" | 38 #include "chrome/browser/ui/webui/options2/startup_pages_handler2.h" |
38 #include "chrome/browser/ui/webui/options2/stop_syncing_handler2.h" | |
39 #include "chrome/browser/ui/webui/options2/web_intents_settings_handler2.h" | 39 #include "chrome/browser/ui/webui/options2/web_intents_settings_handler2.h" |
40 #include "chrome/browser/ui/webui/theme_source.h" | 40 #include "chrome/browser/ui/webui/theme_source.h" |
41 #include "chrome/common/jstemplate_builder.h" | 41 #include "chrome/common/jstemplate_builder.h" |
42 #include "chrome/common/time_format.h" | 42 #include "chrome/common/time_format.h" |
43 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
44 #include "content/browser/renderer_host/render_view_host.h" | 44 #include "content/browser/renderer_host/render_view_host.h" |
45 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
46 #include "content/public/browser/notification_types.h" | 46 #include "content/public/browser/notification_types.h" |
47 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
48 #include "content/public/browser/web_contents_delegate.h" | 48 #include "content/public/browser/web_contents_delegate.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const { | 148 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const { |
149 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile) | 149 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile) |
150 return "application/javascript"; | 150 return "application/javascript"; |
151 | 151 |
152 return "text/html"; | 152 return "text/html"; |
153 } | 153 } |
154 | 154 |
155 //////////////////////////////////////////////////////////////////////////////// | 155 //////////////////////////////////////////////////////////////////////////////// |
156 // | 156 // |
157 // OptionsPageUIHandler | |
158 // | |
159 //////////////////////////////////////////////////////////////////////////////// | |
160 | |
161 OptionsPageUIHandler::OptionsPageUIHandler() { | |
162 } | |
163 | |
164 OptionsPageUIHandler::~OptionsPageUIHandler() { | |
165 } | |
166 | |
167 bool OptionsPageUIHandler::IsEnabled() { | |
168 return true; | |
169 } | |
170 | |
171 // static | |
172 void OptionsPageUIHandler::RegisterStrings( | |
173 DictionaryValue* localized_strings, | |
174 const OptionsStringResource* resources, | |
175 size_t length) { | |
176 for (size_t i = 0; i < length; ++i) { | |
177 localized_strings->SetString( | |
178 resources[i].name, l10n_util::GetStringUTF16(resources[i].id)); | |
179 } | |
180 } | |
181 | |
182 void OptionsPageUIHandler::RegisterTitle(DictionaryValue* localized_strings, | |
183 const std::string& variable_name, | |
184 int title_id) { | |
185 localized_strings->SetString(variable_name, | |
186 l10n_util::GetStringUTF16(title_id)); | |
187 localized_strings->SetString(variable_name + "TabTitle", | |
188 l10n_util::GetStringFUTF16(IDS_OPTIONS_TAB_TITLE, | |
189 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE), | |
190 l10n_util::GetStringUTF16(title_id))); | |
191 } | |
192 | |
193 //////////////////////////////////////////////////////////////////////////////// | |
194 // | |
195 // OptionsUI | 157 // OptionsUI |
196 // | 158 // |
197 //////////////////////////////////////////////////////////////////////////////// | 159 //////////////////////////////////////////////////////////////////////////////// |
198 | 160 |
199 OptionsUI::OptionsUI(content::WebUI* web_ui) | 161 OptionsUI::OptionsUI(content::WebUI* web_ui) |
200 : WebUIController(web_ui), | 162 : WebUIController(web_ui), |
201 initialized_handlers_(false) { | 163 initialized_handlers_(false) { |
202 DictionaryValue* localized_strings = new DictionaryValue(); | 164 DictionaryValue* localized_strings = new DictionaryValue(); |
203 | 165 |
204 CoreOptionsHandler* core_handler; | 166 CoreOptionsHandler* core_handler; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); | 317 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); |
356 #else | 318 #else |
357 command_line_string = | 319 command_line_string = |
358 CommandLine::ForCurrentProcess()->GetCommandLineString(); | 320 CommandLine::ForCurrentProcess()->GetCommandLineString(); |
359 #endif | 321 #endif |
360 | 322 |
361 render_view_host->SetWebUIProperty("commandLineString", command_line_string); | 323 render_view_host->SetWebUIProperty("commandLineString", command_line_string); |
362 } | 324 } |
363 | 325 |
364 } // namespace options2 | 326 } // namespace options2 |
OLD | NEW |