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/autocomplete/autocomplete.h" | 19 #include "chrome/browser/autocomplete/autocomplete.h" |
20 #include "chrome/browser/autocomplete/autocomplete_match.h" | 20 #include "chrome/browser/autocomplete/autocomplete_match.h" |
21 #include "chrome/browser/browser_about_handler.h" | 21 #include "chrome/browser/browser_about_handler.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/ui/webui/options/options_sync_setup_handler.h" | |
25 #include "chrome/browser/ui/webui/options/stop_syncing_handler.h" | |
26 #include "chrome/browser/ui/webui/options2/autofill_options_handler2.h" | 24 #include "chrome/browser/ui/webui/options2/autofill_options_handler2.h" |
27 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h" | 25 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h" |
28 #include "chrome/browser/ui/webui/options2/clear_browser_data_handler2.h" | 26 #include "chrome/browser/ui/webui/options2/clear_browser_data_handler2.h" |
29 #include "chrome/browser/ui/webui/options2/content_settings_handler2.h" | 27 #include "chrome/browser/ui/webui/options2/content_settings_handler2.h" |
30 #include "chrome/browser/ui/webui/options2/cookies_view_handler2.h" | 28 #include "chrome/browser/ui/webui/options2/cookies_view_handler2.h" |
31 #include "chrome/browser/ui/webui/options2/core_options_handler2.h" | 29 #include "chrome/browser/ui/webui/options2/core_options_handler2.h" |
32 #include "chrome/browser/ui/webui/options2/font_settings_handler2.h" | 30 #include "chrome/browser/ui/webui/options2/font_settings_handler2.h" |
33 #include "chrome/browser/ui/webui/options2/handler_options_handler2.h" | 31 #include "chrome/browser/ui/webui/options2/handler_options_handler2.h" |
34 #include "chrome/browser/ui/webui/options2/home_page_overlay_handler2.h" | 32 #include "chrome/browser/ui/webui/options2/home_page_overlay_handler2.h" |
35 #include "chrome/browser/ui/webui/options2/import_data_handler2.h" | 33 #include "chrome/browser/ui/webui/options2/import_data_handler2.h" |
36 #include "chrome/browser/ui/webui/options2/language_options_handler2.h" | 34 #include "chrome/browser/ui/webui/options2/language_options_handler2.h" |
37 #include "chrome/browser/ui/webui/options2/manage_profile_handler2.h" | 35 #include "chrome/browser/ui/webui/options2/manage_profile_handler2.h" |
36 #include "chrome/browser/ui/webui/options2/options_sync_setup_handler.h" | |
38 #include "chrome/browser/ui/webui/options2/password_manager_handler2.h" | 37 #include "chrome/browser/ui/webui/options2/password_manager_handler2.h" |
39 #include "chrome/browser/ui/webui/options2/search_engine_manager_handler2.h" | 38 #include "chrome/browser/ui/webui/options2/search_engine_manager_handler2.h" |
40 #include "chrome/browser/ui/webui/options2/startup_pages_handler2.h" | 39 #include "chrome/browser/ui/webui/options2/startup_pages_handler2.h" |
40 #include "chrome/browser/ui/webui/options2/stop_syncing_handler.h" | |
41 #include "chrome/browser/ui/webui/options2/web_intents_settings_handler2.h" | 41 #include "chrome/browser/ui/webui/options2/web_intents_settings_handler2.h" |
42 #include "chrome/browser/ui/webui/theme_source.h" | 42 #include "chrome/browser/ui/webui/theme_source.h" |
43 #include "chrome/common/jstemplate_builder.h" | 43 #include "chrome/common/jstemplate_builder.h" |
44 #include "chrome/common/time_format.h" | 44 #include "chrome/common/time_format.h" |
45 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
46 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
47 #include "content/public/browser/notification_types.h" | 47 #include "content/public/browser/notification_types.h" |
48 #include "content/public/browser/render_view_host.h" | 48 #include "content/public/browser/render_view_host.h" |
49 #include "content/public/browser/web_contents.h" | 49 #include "content/public/browser/web_contents.h" |
50 #include "content/public/browser/web_contents_delegate.h" | 50 #include "content/public/browser/web_contents_delegate.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 | 154 |
155 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const { | 155 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const { |
156 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile) | 156 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile) |
157 return "application/javascript"; | 157 return "application/javascript"; |
158 | 158 |
159 return "text/html"; | 159 return "text/html"; |
160 } | 160 } |
161 | 161 |
162 //////////////////////////////////////////////////////////////////////////////// | 162 //////////////////////////////////////////////////////////////////////////////// |
163 // | 163 // |
164 // OptionsPageUIHandler | |
165 // | |
166 //////////////////////////////////////////////////////////////////////////////// | |
167 | |
168 OptionsPageUIHandler::OptionsPageUIHandler() { | |
169 } | |
170 | |
171 OptionsPageUIHandler::~OptionsPageUIHandler() { | |
172 } | |
173 | |
174 bool OptionsPageUIHandler::IsEnabled() { | |
175 return true; | |
176 } | |
177 | |
178 // static | |
179 void OptionsPageUIHandler::RegisterStrings( | |
180 DictionaryValue* localized_strings, | |
181 const OptionsStringResource* resources, | |
182 size_t length) { | |
Dan Beam
2012/03/23 03:25:31
er, why do we need |length|?
| |
183 for (size_t i = 0; i < length; ++i) { | |
184 localized_strings->SetString( | |
185 resources[i].name, l10n_util::GetStringUTF16(resources[i].id)); | |
186 } | |
187 } | |
188 | |
189 void OptionsPageUIHandler::RegisterTitle(DictionaryValue* localized_strings, | |
190 const std::string& variable_name, | |
191 int title_id) { | |
192 localized_strings->SetString(variable_name, | |
193 l10n_util::GetStringUTF16(title_id)); | |
194 localized_strings->SetString(variable_name + "TabTitle", | |
195 l10n_util::GetStringFUTF16(IDS_OPTIONS_TAB_TITLE, | |
196 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE), | |
197 l10n_util::GetStringUTF16(title_id))); | |
198 } | |
199 | |
200 //////////////////////////////////////////////////////////////////////////////// | |
201 // | |
164 // OptionsUI | 202 // OptionsUI |
165 // | 203 // |
166 //////////////////////////////////////////////////////////////////////////////// | 204 //////////////////////////////////////////////////////////////////////////////// |
167 | 205 |
168 OptionsUI::OptionsUI(content::WebUI* web_ui) | 206 OptionsUI::OptionsUI(content::WebUI* web_ui) |
169 : WebUIController(web_ui), | 207 : WebUIController(web_ui), |
170 initialized_handlers_(false) { | 208 initialized_handlers_(false) { |
171 DictionaryValue* localized_strings = new DictionaryValue(); | 209 DictionaryValue* localized_strings = new DictionaryValue(); |
172 | 210 |
173 CoreOptionsHandler* core_handler; | 211 CoreOptionsHandler* core_handler; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
353 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); | 391 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); |
354 #else | 392 #else |
355 command_line_string = | 393 command_line_string = |
356 CommandLine::ForCurrentProcess()->GetCommandLineString(); | 394 CommandLine::ForCurrentProcess()->GetCommandLineString(); |
357 #endif | 395 #endif |
358 | 396 |
359 render_view_host->SetWebUIProperty("commandLineString", command_line_string); | 397 render_view_host->SetWebUIProperty("commandLineString", command_line_string); |
360 } | 398 } |
361 | 399 |
362 } // namespace options2 | 400 } // namespace options2 |
OLD | NEW |