diff options
author | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 21:01:40 +0000 |
---|---|---|
committer | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 21:01:40 +0000 |
commit | ed7b2980a035eea169e02ab4c7729b0c8056cf4a (patch) | |
tree | 5fb27d9b5b96151303e91f75ac1746573c799832 /chrome/browser | |
parent | 2578c8ab913d2f5760c310a9969a4cf77205e59f (diff) | |
download | chromium_src-ed7b2980a035eea169e02ab4c7729b0c8056cf4a.zip chromium_src-ed7b2980a035eea169e02ab4c7729b0c8056cf4a.tar.gz chromium_src-ed7b2980a035eea169e02ab4c7729b0c8056cf4a.tar.bz2 |
Advanced (Under the Hood) dom-ui progress.
- Complete implementation of SSL security options for all platforms.
- Implemented the 'Clear auto-opening settings' button.
- Correctly show logging checkbox for Chrome builds only.
- Mostly-complete support for the download path section.
BUG=48482
TEST=Exercise advanced panel in options window using --enable-tabbed-options.
Review URL: http://codereview.chromium.org/2893012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/dom_ui/advanced_options_handler.cc | 206 | ||||
-rw-r--r-- | chrome/browser/dom_ui/advanced_options_handler.h | 55 | ||||
-rw-r--r-- | chrome/browser/dom_ui/core_options_handler.cc | 5 | ||||
-rw-r--r-- | chrome/browser/dom_ui/core_options_handler.h | 5 | ||||
-rw-r--r-- | chrome/browser/dom_ui/dom_ui.h | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/options_ui.cc | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/options_ui.h | 5 | ||||
-rw-r--r-- | chrome/browser/resources/options.html | 2 | ||||
-rw-r--r-- | chrome/browser/resources/options/advanced_options.html | 71 | ||||
-rw-r--r-- | chrome/browser/resources/options/advanced_options.js | 49 | ||||
-rw-r--r-- | chrome/browser/resources/options/options_page.js | 8 | ||||
-rw-r--r-- | chrome/browser/resources/shared/js/cr.js | 7 |
12 files changed, 378 insertions, 49 deletions
diff --git a/chrome/browser/dom_ui/advanced_options_handler.cc b/chrome/browser/dom_ui/advanced_options_handler.cc index 1b56d7d..6999dea 100644 --- a/chrome/browser/dom_ui/advanced_options_handler.cc +++ b/chrome/browser/dom_ui/advanced_options_handler.cc @@ -4,14 +4,37 @@ #include "chrome/browser/dom_ui/advanced_options_handler.h" +#if defined(OS_WIN) +#include <cryptuiapi.h> +#pragma comment(lib, "cryptui.lib") +#endif + #include "app/l10n_util.h" #include "base/basictypes.h" #include "base/callback.h" #include "base/values.h" +#include "chrome/browser/download/download_manager.h" +#include "chrome/browser/pref_service.h" +#include "chrome/browser/profile.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/browser/tab_contents/tab_contents_view.h" +#include "chrome/common/notification_service.h" +#include "chrome/common/notification_type.h" +#include "chrome/common/pref_names.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" +#if defined(OS_WIN) +#include "net/base/ssl_config_service_win.h" +#endif + +#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) +// The URL for Linux ssl certificate configuration help. +const char* const kLinuxCertificatesConfigUrl = + "http://code.google.com/p/chromium/wiki/LinuxCertManagement"; +#endif + AdvancedOptionsHandler::AdvancedOptionsHandler() { } @@ -58,13 +81,13 @@ void AdvancedOptionsHandler::GetLocalizedValues( l10n_util::GetString(IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION)); localized_strings->SetString(L"sslGroupDescription", l10n_util::GetString(IDS_OPTIONS_SSL_GROUP_DESCRIPTION)); - localized_strings->SetString(L"sslUseSsl2", + localized_strings->SetString(L"sslUseSSL2", l10n_util::GetString(IDS_OPTIONS_SSL_USESSL2)); localized_strings->SetString(L"sslCheckRevocation", l10n_util::GetString(IDS_OPTIONS_SSL_CHECKREVOCATION)); - localized_strings->SetString(L"sslUseSsl3", + localized_strings->SetString(L"sslUseSSL3", l10n_util::GetString(IDS_OPTIONS_SSL_USESSL3)); - localized_strings->SetString(L"sslUseTsl1", + localized_strings->SetString(L"sslUseTLS1", l10n_util::GetString(IDS_OPTIONS_SSL_USETLS1)); localized_strings->SetString(L"networkDNSPrefetchEnabledDescription", l10n_util::GetString(IDS_NETWORK_DNS_PREFETCH_ENABLED_DESCRIPTION)); @@ -100,24 +123,189 @@ void AdvancedOptionsHandler::GetLocalizedValues( l10n_util::GetString(IDS_OPTIONS_DISABLE_SERVICES)); } +void AdvancedOptionsHandler::Initialize() { + SetupDownloadLocationPath(); + SetupAutoOpenFileTypesDisabledAttribute(); +#if defined(OS_WIN) + SetupSSLConfigSettings(); +#endif +} + +DOMMessageHandler* AdvancedOptionsHandler::Attach(DOMUI* dom_ui) { + // Call through to superclass. + DOMMessageHandler* handler = OptionsPageUIHandler::Attach(dom_ui); + + // Register for preferences that we need to observe manually. These have + // special behaviors that aren't handled by the standard prefs UI. + DCHECK(dom_ui_); + PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs(); + default_download_location_.Init(prefs::kDownloadDefaultDirectory, + pref_service, this); + auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, + pref_service, this); + + // Return result from the superclass. + return handler; +} + void AdvancedOptionsHandler::RegisterMessages() { -#if defined(OS_MACOSX) - dom_ui_->RegisterMessageCallback("showNetworkProxySettings", + // Setup handlers specific to this panel. + DCHECK(dom_ui_); + dom_ui_->RegisterMessageCallback("selectDownloadLocation", NewCallback(this, - &AdvancedOptionsHandler::ShowNetworkProxySettings)); + &AdvancedOptionsHandler::HandleSelectDownloadLocation)); + dom_ui_->RegisterMessageCallback("autoOpenFileTypesAction", + NewCallback(this, + &AdvancedOptionsHandler::HandleAutoOpenButton)); dom_ui_->RegisterMessageCallback("showManageSSLCertificates", NewCallback(this, &AdvancedOptionsHandler::ShowManageSSLCertificates)); + dom_ui_->RegisterMessageCallback("showNetworkProxySettings", + NewCallback(this, + &AdvancedOptionsHandler::ShowNetworkProxySettings)); + +#if defined(OS_WIN) + // Setup Windows specific callbacks. + dom_ui_->RegisterMessageCallback("checkRevocationCheckboxAction", + NewCallback(this, + &AdvancedOptionsHandler::HandleCheckRevocationCheckbox)); + dom_ui_->RegisterMessageCallback("useSSL2CheckboxAction", + NewCallback(this, + &AdvancedOptionsHandler::HandleUseSSL2Checkbox)); #endif } -#if defined(OS_MACOSX) +void AdvancedOptionsHandler::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + if (type == NotificationType::PREF_CHANGED) { + std::wstring* pref_name = Details<std::wstring>(details).ptr(); + if (*pref_name == prefs::kDownloadDefaultDirectory) { + SetupDownloadLocationPath(); + } else if (*pref_name == prefs::kDownloadExtensionsToOpen) { + SetupAutoOpenFileTypesDisabledAttribute(); + } + } +} + +void AdvancedOptionsHandler::HandleSelectDownloadLocation(const Value* value) { + PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs(); + select_folder_dialog_ = SelectFileDialog::Create(this); + select_folder_dialog_->SelectFile( + SelectFileDialog::SELECT_FOLDER, + l10n_util::GetStringUTF16(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE), + pref_service->GetFilePath(prefs::kDownloadDefaultDirectory), + NULL, 0, FILE_PATH_LITERAL(""), + dom_ui_->tab_contents()->view()->GetTopLevelNativeWindow(), NULL); +} + +void AdvancedOptionsHandler::FileSelected(const FilePath& path, int index, + void* params) { + default_download_location_.SetValue(path); + SetupDownloadLocationPath(); +} + +void AdvancedOptionsHandler::HandleAutoOpenButton(const Value* value) { + DCHECK(dom_ui_); + DownloadManager* manager = dom_ui_->GetProfile()->GetDownloadManager(); + if (manager) manager->ResetAutoOpenFiles(); +} + +#if defined(OS_WIN) +void AdvancedOptionsHandler::HandleCheckRevocationCheckbox(const Value* value) { + if (!value || !value->IsType(Value::TYPE_LIST)) { + LOG(WARNING) << "checkRevocationCheckboxAction called with missing or " << + "invalid value"; + return; + } + const ListValue* list = static_cast<const ListValue*>(value); + if (list->GetSize() < 1) { + LOG(WARNING) << "checkRevocationCheckboxAction called with too few " << + "arguments"; + return; + } + std::string checked_str; + if (list->GetString(0, &checked_str)) { + net::SSLConfigServiceWin::SetRevCheckingEnabled(checked_str == "true"); + } +} + +void AdvancedOptionsHandler::HandleUseSSL2Checkbox(const Value* value) { + if (!value || !value->IsType(Value::TYPE_LIST)) { + LOG(WARNING) << "useSSL2CheckboxAction called with missing or " << + "invalid value"; + return; + } + const ListValue* list = static_cast<const ListValue*>(value); + if (list->GetSize() < 1) { + LOG(WARNING) << "useSSL2CheckboxAction called with too few " << + "arguments"; + return; + } + std::string checked_str; + if (list->GetString(0, &checked_str)) { + net::SSLConfigServiceWin::SetSSL2Enabled(checked_str == "true"); + } +} +#endif + +void AdvancedOptionsHandler::SetupDownloadLocationPath() { + DCHECK(dom_ui_); + StringValue value(default_download_location_.GetValue().value()); + dom_ui_->CallJavascriptFunction( + L"advancedOptionsSetDownloadLocationPath", value); +} + +void AdvancedOptionsHandler::SetupAutoOpenFileTypesDisabledAttribute() { + // Set the enabled state for the AutoOpenFileTypesResetToDefault button. + // We enable the button if the user has any auto-open file types registered. + DCHECK(dom_ui_); + DownloadManager* manager = dom_ui_->GetProfile()->GetDownloadManager(); + bool disabled = !(manager && manager->HasAutoOpenFileTypesRegistered()); + FundamentalValue value(disabled); + dom_ui_->CallJavascriptFunction( + L"advancedOptionsSetAutoOpenFileTypesDisabledAttribute", value); +} + +#if defined(OS_WIN) +void AdvancedOptionsHandler::SetupSSLConfigSettings() { + DCHECK(dom_ui_); + bool checkRevocationSetting = false; + bool useSSLSetting = false; + + net::SSLConfig config; + if (net::SSLConfigServiceWin::GetSSLConfigNow(&config)) { + checkRevocationSetting = config.rev_checking_enabled; + useSSLSetting = config.ssl2_enabled; + } + FundamentalValue checkRevocationValue(checkRevocationSetting); + dom_ui_->CallJavascriptFunction( + L"advancedOptionsSetCheckRevocationCheckboxState", checkRevocationValue); + FundamentalValue useSSLValue(useSSLSetting); + dom_ui_->CallJavascriptFunction( + L"advancedOptionsSetUseSSL2CheckboxStatechecked", useSSLValue); +} +#endif + void AdvancedOptionsHandler::ShowNetworkProxySettings(const Value* value) { +#if defined(OS_MACOSX) AdvancedOptionsUtilities::ShowNetworkProxySettings(); +#endif } void AdvancedOptionsHandler::ShowManageSSLCertificates(const Value* value) { +#if defined(OS_MACOSX) AdvancedOptionsUtilities::ShowManageSSLCertificates(); -} +#elif defined(OS_WIN) + DCHECK(dom_ui_); + CRYPTUI_CERT_MGR_STRUCT cert_mgr = { 0 }; + cert_mgr.dwSize = sizeof(CRYPTUI_CERT_MGR_STRUCT); + cert_mgr.hwndParent = + dom_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); + ::CryptUIDlgCertMgr(&cert_mgr); +#elif defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) + DCHECK(dom_ui_); + dom_ui_->tab_contents()->OpenURL(GURL(kLinuxCertificatesConfigUrl), GURL(), + NEW_WINDOW, PageTransition::LINK); #endif - +} diff --git a/chrome/browser/dom_ui/advanced_options_handler.h b/chrome/browser/dom_ui/advanced_options_handler.h index d040b50..2fd9054 100644 --- a/chrome/browser/dom_ui/advanced_options_handler.h +++ b/chrome/browser/dom_ui/advanced_options_handler.h @@ -6,33 +6,78 @@ #define CHROME_BROWSER_DOM_UI_ADVANCED_OPTIONS_HANDLER_H_ #include "chrome/browser/dom_ui/options_ui.h" +#include "chrome/browser/pref_member.h" +#include "chrome/browser/shell_dialogs.h" #if defined(OS_MACOSX) #include "chrome/browser/dom_ui/advanced_options_utils_mac.h" #endif // Chrome advanced options page UI handler. -class AdvancedOptionsHandler : public OptionsPageUIHandler { +class AdvancedOptionsHandler + : public OptionsPageUIHandler, + public SelectFileDialog::Listener { public: AdvancedOptionsHandler(); virtual ~AdvancedOptionsHandler(); // OptionsUIHandler implementation. virtual void GetLocalizedValues(DictionaryValue* localized_strings); + virtual void Initialize(); // DOMMessageHandler implementation. + virtual DOMMessageHandler* Attach(DOMUI* dom_ui); virtual void RegisterMessages(); + // NotificationObserver implementation. + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + // SelectFileDialog::Listener implementation + virtual void FileSelected(const FilePath& path, int index, void* params); + private: -#if defined(OS_MACOSX) + // Callback for the "selectDownloadLocation" message. This will prompt + // the user for a destination folder using platform-specific APIs. + void HandleSelectDownloadLocation(const Value* value); + + // Callback for the "autoOpenFileTypesResetToDefault" message. This will + // remove all auto-open file-type settings. + void HandleAutoOpenButton(const Value* value); + +#if defined(OS_WIN) + // Callback for the "Check SSL Revocation" checkbox. This is needed so we + // can support manual handling on Windows. + void HandleCheckRevocationCheckbox(const Value* value); + + // Callback for the "Use SSL2" checkbox. This is needed so we can support + // manual handling on Windows. + void HandleUseSSL2Checkbox(const Value* value); +#endif + + // Setup the download path based on user preferences. + void SetupDownloadLocationPath(); + + // Setup the enabled state of the reset button. + void SetupAutoOpenFileTypesDisabledAttribute(); + +#if defined(OS_WIN) + // Setup the checked state SSL related checkboxes. + void SetupSSLConfigSettings(); +#endif + // Callback for the "showNetworkProxySettings" message. This will invoke - // the Mac OS X Network panel for configuring proxy settings. + // an appropriate dialog for configuring proxy settings. void ShowNetworkProxySettings(const Value* value); // Callback for the "showManageSSLCertificates" message. This will invoke - // the Mac OS X Keychain application for inspecting certificates. + // an appropriate certificate management action based on the platform. void ShowManageSSLCertificates(const Value* value); -#endif + + scoped_refptr<SelectFileDialog> select_folder_dialog_; + FilePathPrefMember default_download_location_; + StringPrefMember auto_open_files_; DISALLOW_COPY_AND_ASSIGN(AdvancedOptionsHandler); }; diff --git a/chrome/browser/dom_ui/core_options_handler.cc b/chrome/browser/dom_ui/core_options_handler.cc index 527055e..45e9a81 100644 --- a/chrome/browser/dom_ui/core_options_handler.cc +++ b/chrome/browser/dom_ui/core_options_handler.cc @@ -67,6 +67,8 @@ void CoreOptionsHandler::Observe(NotificationType type, } void CoreOptionsHandler::RegisterMessages() { + dom_ui_->RegisterMessageCallback("coreOptionsInitialize", + NewCallback(this, &CoreOptionsHandler::HandleInitialize)); dom_ui_->RegisterMessageCallback("fetchPrefs", NewCallback(this, &CoreOptionsHandler::HandleFetchPrefs)); dom_ui_->RegisterMessageCallback("observePrefs", @@ -79,6 +81,9 @@ void CoreOptionsHandler::RegisterMessages() { NewCallback(this, &CoreOptionsHandler::HandleSetStringPref)); } +void CoreOptionsHandler::HandleInitialize(const Value* value) { + (static_cast<OptionsUI*>(dom_ui_))->InitializeHandlers(); +} void CoreOptionsHandler::HandleFetchPrefs(const Value* value) { if (!value || !value->IsType(Value::TYPE_LIST)) diff --git a/chrome/browser/dom_ui/core_options_handler.h b/chrome/browser/dom_ui/core_options_handler.h index 370f1f1..12d35a7 100644 --- a/chrome/browser/dom_ui/core_options_handler.h +++ b/chrome/browser/dom_ui/core_options_handler.h @@ -31,6 +31,11 @@ class CoreOptionsHandler : public OptionsPageUIHandler { private: typedef std::multimap<std::wstring, std::wstring> PreferenceCallbackMap; + // Callback for the "coreOptionsInitialize" message. This message will + // trigger the Initialize() method of all other handlers so that final + // setup can be performed before the page is shown. + void HandleInitialize(const Value* value); + // Callback for the "fetchPrefs" message. This message accepts the list of // preference names passed as |value| parameter (ListValue). It passes results // dictionary of preference values by calling prefsFetched() JS method on the diff --git a/chrome/browser/dom_ui/dom_ui.h b/chrome/browser/dom_ui/dom_ui.h index 75ada3e..4c20dff 100644 --- a/chrome/browser/dom_ui/dom_ui.h +++ b/chrome/browser/dom_ui/dom_ui.h @@ -132,6 +132,9 @@ class DOMUI { int bindings_; // The bindings from BindingsPolicy that should be enabled for // this page. + // The DOMMessageHandlers we own. + std::vector<DOMMessageHandler*> handlers_; + private: // Execute a string of raw Javascript on the page. void ExecuteJavascript(const std::wstring& javascript); @@ -139,9 +142,6 @@ class DOMUI { // Non-owning pointer to the TabContents this DOMUI is associated with. TabContents* tab_contents_; - // The DOMMessageHandlers we own. - std::vector<DOMMessageHandler*> handlers_; - // A map of message name -> message handling callback. typedef std::map<std::string, MessageCallback*> MessageCallbackMap; MessageCallbackMap message_callbacks_; @@ -161,6 +161,7 @@ class DOMMessageHandler { // virtual so that subclasses can do special init work as soon as the dom_ui // is provided. Returns |this| for convenience. virtual DOMMessageHandler* Attach(DOMUI* dom_ui); + protected: // Adds "url" and "title" keys on incoming dictionary, setting title // as the url as a fallback on empty title. diff --git a/chrome/browser/dom_ui/options_ui.cc b/chrome/browser/dom_ui/options_ui.cc index 9efa714..d10868b 100644 --- a/chrome/browser/dom_ui/options_ui.cc +++ b/chrome/browser/dom_ui/options_ui.cc @@ -141,6 +141,13 @@ RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { return NULL; } +void OptionsUI::InitializeHandlers() { + std::vector<DOMMessageHandler*>::iterator iter; + for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) { + (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); + } +} + void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, OptionsPageUIHandler* handler) { DCHECK(handler); diff --git a/chrome/browser/dom_ui/options_ui.h b/chrome/browser/dom_ui/options_ui.h index a13ab94..e8f1585 100644 --- a/chrome/browser/dom_ui/options_ui.h +++ b/chrome/browser/dom_ui/options_ui.h @@ -50,6 +50,9 @@ class OptionsPageUIHandler : public DOMMessageHandler, // Collects localized strings for options page. virtual void GetLocalizedValues(DictionaryValue* localized_strings) = 0; + // Initialize the page. Called once the DOM is available for manipulation. + virtual void Initialize() {} + // DOMMessageHandler implementation. virtual void RegisterMessages() {} @@ -75,6 +78,8 @@ class OptionsUI : public DOMUI { static RefCountedMemory* GetFaviconResourceBytes(); + void InitializeHandlers(); + private: void AddOptionsPageUIHandler(DictionaryValue* localized_strings, OptionsPageUIHandler* handler); diff --git a/chrome/browser/resources/options.html b/chrome/browser/resources/options.html index 0fd0962..4044526 100644 --- a/chrome/browser/resources/options.html +++ b/chrome/browser/resources/options.html @@ -66,6 +66,8 @@ function load() { OptionsPage.registerOverlay(dummyPage); Preferences.getInstance().initialize(); + OptionsPage.initialize(); + if (cr.isChromeOS) { OptionsPage.showPageByName(SystemOptions.getInstance().name); } else { diff --git a/chrome/browser/resources/options/advanced_options.html b/chrome/browser/resources/options/advanced_options.html index 8ef2162..3cefd7c 100644 --- a/chrome/browser/resources/options/advanced_options.html +++ b/chrome/browser/resources/options/advanced_options.html @@ -37,13 +37,13 @@ pref="safebrowsing.enabled" type="checkbox"><span i18n-content="safeBrowsingEnableProtection"></span></label></td> </tr> - <!-- TODO(csilv): This option only exists on Chrome builds, needs to be - ommitted for Chromium - <tr id="metricsReportingCheckbox"> - <td class="option-name"><label><input id="metricsReportingEnabled" - pref="user_experience_metrics.reporting_enabled" type="checkbox"> - <span i18n-content="enableLogging"></span></label></td> - </tr>--> + <if expr="pp_ifdef('_google_chrome')"> + <tr id="metricsReportingCheckbox"> + <td class="option-name"><label><input id="metricsReportingEnabled" + pref="user_experience_metrics.reporting_enabled" type="checkbox"> + <span i18n-content="enableLogging"></span></label></td> + </tr> + </if> </table> </section> <section> @@ -96,12 +96,14 @@ <section> <h3 i18n-content="advancedSectionTitleContent"></h3> <table class="option-control-table"> - <tr id="tabsToLinksCheckbox"> - <td class="option-name"><label><input id="tabsToLinksPref" - pref="webkit.webprefs.tabs_to_links" type="checkbox"><span - i18n-content="tabsToLinksPref"></span></label></td> - </tr> - <tr id="promptForDownloadCheckbox"><td> + <if expr="os == 'darwin'"> + <tr id="tabsToLinksCheckbox"> + <td class="option-name"><label><input id="tabsToLinksPref" + pref="webkit.webprefs.tabs_to_links" type="checkbox"><span + i18n-content="tabsToLinksPref"></span></label></td> + </tr> + </if> + <tr id="fontSettingsConfigureFontsOnlyButton"><td> <button id="fontSettingsConfigureFontsOnlyButton" i18n-content="fontSettingsConfigureFontsOnlyButton"></button> </td></tr> @@ -116,13 +118,42 @@ <button id="certificatesManageButton" i18n-content="certificatesManageButton"></button> </td></tr> - <!-- TODO(csilv): Not supported on all platforms - <tr id="sslCheckRevocationCheckbox"> - <td class="option-name"><label><input id="sslCheckRevocation" - pref="ssl.rev_checking.enabled" type="checkbox"><span - i18n-content="sslCheckRevocation"></span></label></td> - </tr> - --> + <if expr="os == 'win32'"> + <!-- Configure these options for manual handling on windows --> + <tr id="sslCheckRevocationCheckbox"> + <td class="option-name"><label><input id="sslCheckRevocation" + type="checkbox"><span i18n-content="sslCheckRevocation"></span> + </label></td> + </tr> + <tr id="sslUseSSL2Checkbox"> + <td class="option-name"><label><input id="sslUseSSL2" + type="checkbox"><span i18n-content="sslUseSSL2"></span> + </label></td> + </tr> + </if> + <if expr="os == 'linux2' or os.find('bsd') != -1"> + <!-- Configure these options for Linux/BSD as preference keys --> + <tr id="sslCheckRevocationCheckbox"> + <td class="option-name"><label><input id="sslCheckRevocation" + pref="ssl.rev_checking.enabled" type="checkbox"><span + i18n-content="sslCheckRevocation"></span></label></td> + </tr> + <tr id="sslUseSSL2Checkbox"> + <td class="option-name"><label><input id="sslUseSSL2" + pref="ssl.ssl2.enabled" type="checkbox"><span + i18n-content="sslUseSSL2"></span></label></td> + </tr> + <tr id="sslUseSSL3Checkbox"> + <td class="option-name"><label><input id="sslUseSSL3" + pref="ssl.ssl3.enabled" type="checkbox"><span + i18n-content="sslUseSSL3"></span></label></td> + </tr> + <tr id="sslUseTLS1Checkbox"> + <td class="option-name"><label><input id="sslUseTLS1" + pref="ssl.tls1.enabled" type="checkbox"><span + i18n-content="sslUseTLS1"></span></label></td> + </tr> + </if> </table> </section> </div> diff --git a/chrome/browser/resources/options/advanced_options.js b/chrome/browser/resources/options/advanced_options.js index fd19b72..a78e8e5 100644 --- a/chrome/browser/resources/options/advanced_options.js +++ b/chrome/browser/resources/options/advanced_options.js @@ -26,7 +26,7 @@ AdvancedOptions.prototype = { // Call base class implementation to starts preference initialization. OptionsPage.prototype.initializePage.call(this); - // Setup function handlers for buttons. + // Setup click handlers for buttons. $('privacyContentSettingsButton').onclick = function(event) { OptionsPage.showPageByName('content'); }; @@ -41,26 +41,51 @@ AdvancedOptions.prototype = { } }; $('downloadLocationBrowseButton').onclick = function(event) { - // TODO(csilv): spawn OS native file prompt dialog. + chrome.send('selectDownloadLocation'); }; $('autoOpenFileTypesResetToDefault').onclick = function(event) { - // TODO(csilv): do whatever this button must do...? + chrome.send('autoOpenFileTypesAction'); }; $('fontSettingsConfigureFontsOnlyButton').onclick = function(event) { // TODO(csilv): spawn font settings sub-dialog. }; $('certificatesManageButton').onclick = function(event) { - if (cr.isMac) { - chrome.send('showManageSSLCertificates'); - } else { - // TODO(csilv): spawn manage SSL certs sub-dialog. - } + chrome.send('showManageSSLCertificates'); }; - // Hide tabsToLinks checkbox on non-Mac platforms. - if (!cr.isMac) { - $('tabsToLinksCheckbox').style.display = 'none'; + if (cr.isWindows) { + $('sslCheckRevocation').onclick = function(event) { + chrome.send('checkRevocationCheckboxAction', + [String($('sslCheckRevocation').checked)]); + }; + $('sslUseSSL2').onclick = function(event) { + chrome.send('useSSL2CheckboxAction', + [String($('sslUseSSL2').checked)]); + }; } - }, + } }; +// +// Chrome callbacks +// + +// Set the download path. +function advancedOptionsSetDownloadLocationPath(path) { + $('downloadLocationPath').value = path; +} + +// Set the enabled state for the autoOpenFileTypesResetToDefault button. +function advancedOptionsSetAutoOpenFileTypesDisabledAttribute(disabled) { + $('autoOpenFileTypesResetToDefault').disabled = disabled; +} + +// Set the checked state for the sslCheckRevocation checkbox. +function advancedOptionsSetCheckRevocationCheckboxState(checked) { + $('sslCheckRevocation').checked = checked; +} + +// Set the checked state for the sslUseSSL2 checkbox. +function advancedOptionsSetUseSSL2CheckboxState(checked) { + $('sslUseSSL2').checked = checked; +} diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js index d4984c8..50cff73 100644 --- a/chrome/browser/resources/options/options_page.js +++ b/chrome/browser/resources/options/options_page.js @@ -112,6 +112,14 @@ OptionsPage.registerOverlay = function(page) { page.initializePage(); }; +/** + * Initializes the complete options page. This will cause + * all C++ handlers to be invoked to do final setup. + */ +OptionsPage.initialize = function() { + chrome.send('coreOptionsInitialize'); +}; + OptionsPage.prototype = { /** * Initializes page content. diff --git a/chrome/browser/resources/shared/js/cr.js b/chrome/browser/resources/shared/js/cr.js index 8558171..6920b19 100644 --- a/chrome/browser/resources/shared/js/cr.js +++ b/chrome/browser/resources/shared/js/cr.js @@ -11,6 +11,12 @@ const cr = (function() { const isMac = /Mac/.test(navigator.platform); /** + * Whether this is on the Windows platform or not. + * @type {boolean} + */ + const isWindows = /Win/.test(navigator.platform); + + /** * Whether this is on chromeOS or not. * @type {boolean} */ @@ -323,6 +329,7 @@ const cr = (function() { return { isMac: isMac, + isWindows: isWindows, isChromeOS: isChromeOS, define: define, defineProperty: defineProperty, |