diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 18:47:51 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 18:47:51 +0000 |
commit | 4c2da3a63c04cc52554b5057670a5ad7c7b8d800 (patch) | |
tree | 6cb0281d3afb8ce6b911f3eb8a236003cff0b033 /chrome/browser/views/external_protocol_dialog.cc | |
parent | e4056b938cb73137dca124ec385f891a0c86b1bd (diff) | |
download | chromium_src-4c2da3a63c04cc52554b5057670a5ad7c7b8d800.zip chromium_src-4c2da3a63c04cc52554b5057670a5ad7c7b8d800.tar.gz chromium_src-4c2da3a63c04cc52554b5057670a5ad7c7b8d800.tar.bz2 |
Add "remember my choice" checkbox for windows external protocol dialog.
BUG=24085
Review URL: http://codereview.chromium.org/332039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/external_protocol_dialog.cc')
-rw-r--r-- | chrome/browser/views/external_protocol_dialog.cc | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/chrome/browser/views/external_protocol_dialog.cc b/chrome/browser/views/external_protocol_dialog.cc index 4240e21..1f7bf42 100644 --- a/chrome/browser/views/external_protocol_dialog.cc +++ b/chrome/browser/views/external_protocol_dialog.cc @@ -60,9 +60,8 @@ std::wstring ExternalProtocolDialog::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { if (button == MessageBoxFlags::DIALOGBUTTON_OK) return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT); - - // Set the button to have a default name. - return L""; + else + return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_CANCEL_BUTTON_TEXT); } std::wstring ExternalProtocolDialog::GetWindowTitle() const { @@ -73,6 +72,20 @@ void ExternalProtocolDialog::DeleteDelegate() { delete this; } +bool ExternalProtocolDialog::Cancel() { + // We also get called back here if the user closes the dialog or presses + // escape. In these cases it would be preferable to ignore the state of the + // check box but MessageBox doesn't distinguish this from pressing the cancel + // button. + if (message_box_view_->IsCheckBoxSelected()) { + ExternalProtocolHandler::SetBlockState( + UTF8ToWide(url_.scheme()), ExternalProtocolHandler::BLOCK); + } + + // Returning true closes the dialog. + return true; +} + bool ExternalProtocolDialog::Accept() { // We record how long it takes the user to accept an external protocol. If // users start accepting these dialogs too quickly, we should worry about @@ -80,6 +93,11 @@ bool ExternalProtocolDialog::Accept() { UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", base::Time::Now() - creation_time_); + if (message_box_view_->IsCheckBoxSelected()) { + ExternalProtocolHandler::SetBlockState( + UTF8ToWide(url_.scheme()), ExternalProtocolHandler::DONT_BLOCK); + } + ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_); // Returning true closes the dialog. return true; @@ -112,6 +130,9 @@ ExternalProtocolDialog::ExternalProtocolDialog(TabContents* tab_contents, message_text, L"", kMessageWidth); + message_box_view_->SetCheckBoxLabel( + l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); + HWND root_hwnd; if (tab_contents_) { root_hwnd = GetAncestor(tab_contents_->GetContentNativeView(), GA_ROOT); |