OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/options/advanced_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/advanced_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
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/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/download/download_manager.h" | 15 #include "chrome/browser/download/download_manager.h" |
16 #include "chrome/browser/download/download_prefs.h" | 16 #include "chrome/browser/download/download_prefs.h" |
17 #include "chrome/browser/google/google_util.h" | 17 #include "chrome/browser/google/google_util.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 19 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
20 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 20 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
21 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 21 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/service/service_process_control.h" | 23 #include "chrome/browser/service/service_process_control.h" |
24 #include "chrome/browser/ui/options/options_util.h" | 24 #include "chrome/browser/ui/options/options_util.h" |
25 #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h" | 25 #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h" |
| 26 #include "chrome/common/chrome_notification_types.h" |
26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
29 #include "content/browser/tab_contents/tab_contents.h" | 30 #include "content/browser/tab_contents/tab_contents.h" |
30 #include "content/browser/tab_contents/tab_contents_view.h" | 31 #include "content/browser/tab_contents/tab_contents_view.h" |
31 #include "content/browser/user_metrics.h" | 32 #include "content/browser/user_metrics.h" |
| 33 #include "content/common/content_notification_types.h" |
32 #include "content/common/notification_details.h" | 34 #include "content/common/notification_details.h" |
33 #include "content/common/notification_type.h" | |
34 #include "grit/chromium_strings.h" | 35 #include "grit/chromium_strings.h" |
35 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
36 #include "grit/locale_settings.h" | 37 #include "grit/locale_settings.h" |
37 #include "ui/base/l10n/l10n_util.h" | 38 #include "ui/base/l10n/l10n_util.h" |
38 | 39 |
39 #if !defined(OS_CHROMEOS) | 40 #if !defined(OS_CHROMEOS) |
40 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" | 41 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" |
41 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" | 42 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" |
42 #endif | 43 #endif |
43 | 44 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 web_ui_->RegisterMessageCallback("useTLS1CheckboxAction", | 300 web_ui_->RegisterMessageCallback("useTLS1CheckboxAction", |
300 NewCallback(this, | 301 NewCallback(this, |
301 &AdvancedOptionsHandler::HandleUseTLS1Checkbox)); | 302 &AdvancedOptionsHandler::HandleUseTLS1Checkbox)); |
302 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 303 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
303 web_ui_->RegisterMessageCallback("backgroundModeAction", | 304 web_ui_->RegisterMessageCallback("backgroundModeAction", |
304 NewCallback(this, | 305 NewCallback(this, |
305 &AdvancedOptionsHandler::HandleBackgroundModeCheckbox)); | 306 &AdvancedOptionsHandler::HandleBackgroundModeCheckbox)); |
306 #endif | 307 #endif |
307 } | 308 } |
308 | 309 |
309 void AdvancedOptionsHandler::Observe(NotificationType type, | 310 void AdvancedOptionsHandler::Observe(int type, |
310 const NotificationSource& source, | 311 const NotificationSource& source, |
311 const NotificationDetails& details) { | 312 const NotificationDetails& details) { |
312 if (type == NotificationType::PREF_CHANGED) { | 313 if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
313 std::string* pref_name = Details<std::string>(details).ptr(); | 314 std::string* pref_name = Details<std::string>(details).ptr(); |
314 if ((*pref_name == prefs::kDownloadDefaultDirectory) || | 315 if ((*pref_name == prefs::kDownloadDefaultDirectory) || |
315 (*pref_name == prefs::kPromptForDownload) || | 316 (*pref_name == prefs::kPromptForDownload) || |
316 (*pref_name == prefs::kAllowFileSelectionDialogs)) { | 317 (*pref_name == prefs::kAllowFileSelectionDialogs)) { |
317 SetupDownloadLocationPath(); | 318 SetupDownloadLocationPath(); |
318 SetupPromptForDownload(); | 319 SetupPromptForDownload(); |
319 } else if (*pref_name == prefs::kDownloadExtensionsToOpen) { | 320 } else if (*pref_name == prefs::kDownloadExtensionsToOpen) { |
320 SetupAutoOpenFileTypesDisabledAttribute(); | 321 SetupAutoOpenFileTypesDisabledAttribute(); |
321 } else if (proxy_prefs_->IsObserved(*pref_name)) { | 322 } else if (proxy_prefs_->IsObserved(*pref_name)) { |
322 SetupProxySettingsSection(); | 323 SetupProxySettingsSection(); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 web_ui_->CallJavascriptFunction( | 635 web_ui_->CallJavascriptFunction( |
635 "options.AdvancedOptions.SetUseSSL3CheckboxState", checked, disabled); | 636 "options.AdvancedOptions.SetUseSSL3CheckboxState", checked, disabled); |
636 } | 637 } |
637 { | 638 { |
638 FundamentalValue checked(tls1_enabled_.GetValue()); | 639 FundamentalValue checked(tls1_enabled_.GetValue()); |
639 FundamentalValue disabled(tls1_enabled_.IsManaged()); | 640 FundamentalValue disabled(tls1_enabled_.IsManaged()); |
640 web_ui_->CallJavascriptFunction( | 641 web_ui_->CallJavascriptFunction( |
641 "options.AdvancedOptions.SetUseTLS1CheckboxState", checked, disabled); | 642 "options.AdvancedOptions.SetUseTLS1CheckboxState", checked, disabled); |
642 } | 643 } |
643 } | 644 } |
OLD | NEW |