Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: chrome/browser/views/external_protocol_dialog.cc

Issue 332039: Add "remember my choice" checkbox for windows external protocol dialog.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/external_protocol_dialog.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/external_protocol_dialog.cc
===================================================================
--- chrome/browser/views/external_protocol_dialog.cc (revision 30074)
+++ chrome/browser/views/external_protocol_dialog.cc (working copy)
@@ -60,9 +60,8 @@
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 @@
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 @@
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 @@
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);
« no previous file with comments | « chrome/browser/views/external_protocol_dialog.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698