| Index: chrome/browser/ui/cocoa/external_protocol_dialog.mm
|
| diff --git a/chrome/browser/ui/cocoa/external_protocol_dialog.mm b/chrome/browser/ui/cocoa/external_protocol_dialog.mm
|
| index 73db5415207e2c4b496df794a30e8d20d21de58c..531cb0eb5aa457654f1e61a99e2a23c42add2a99 100644
|
| --- a/chrome/browser/ui/cocoa/external_protocol_dialog.mm
|
| +++ b/chrome/browser/ui/cocoa/external_protocol_dialog.mm
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/metrics/histogram_macros.h"
|
| +#include "base/metrics/sparse_histogram.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/browser/external_protocol/external_protocol_handler.h"
|
| @@ -61,40 +62,20 @@ void ExternalProtocolHandler::RunExternalProtocolDialog(
|
| alert_ = [[NSAlert alloc] init];
|
|
|
| [alert_ setMessageText:
|
| - l10n_util::GetNSStringWithFixup(IDS_EXTERNAL_PROTOCOL_TITLE)];
|
| + l10n_util::GetNSStringFWithFixup(IDS_EXTERNAL_PROTOCOL_TITLE, appName)];
|
|
|
| - NSButton* allowButton = [alert_ addButtonWithTitle:
|
| - l10n_util::GetNSStringWithFixup(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT)];
|
| + NSButton* allowButton = [alert_
|
| + addButtonWithTitle:l10n_util::GetNSStringFWithFixup(
|
| + IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT, appName)];
|
| [allowButton setKeyEquivalent:@""]; // disallow as default
|
| [alert_ addButtonWithTitle:
|
| l10n_util::GetNSStringWithFixup(
|
| IDS_EXTERNAL_PROTOCOL_CANCEL_BUTTON_TEXT)];
|
|
|
| - const size_t kMaxUrlWithoutSchemeSize = 256;
|
| - base::string16 elided_url_without_scheme;
|
| - gfx::ElideString(base::ASCIIToUTF16(url_.possibly_invalid_spec()),
|
| - kMaxUrlWithoutSchemeSize, &elided_url_without_scheme);
|
| -
|
| - NSString* urlString = l10n_util::GetNSStringFWithFixup(
|
| - IDS_EXTERNAL_PROTOCOL_INFORMATION,
|
| - base::ASCIIToUTF16(url_.scheme() + ":"),
|
| - elided_url_without_scheme);
|
| - NSString* appString = l10n_util::GetNSStringFWithFixup(
|
| - IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH,
|
| - appName);
|
| - NSString* warningString =
|
| - l10n_util::GetNSStringWithFixup(IDS_EXTERNAL_PROTOCOL_WARNING);
|
| - NSString* informativeText =
|
| - [NSString stringWithFormat:@"%@\n\n%@\n\n%@",
|
| - urlString,
|
| - appString,
|
| - warningString];
|
| -
|
| - [alert_ setInformativeText:informativeText];
|
| -
|
| [alert_ setShowsSuppressionButton:YES];
|
| - [[alert_ suppressionButton] setTitle:
|
| - l10n_util::GetNSStringWithFixup(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)];
|
| + [[alert_ suppressionButton]
|
| + setTitle:l10n_util::GetNSStringFWithFixup(
|
| + IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT, appName)];
|
|
|
| [alert_ beginSheetModalForWindow:nil // nil here makes it app-modal
|
| modalDelegate:self
|
| @@ -127,8 +108,14 @@ void ExternalProtocolHandler::RunExternalProtocolDialog(
|
| }
|
|
|
| // Set the "don't warn me again" info.
|
| - if ([[alert_ suppressionButton] state] == NSOnState)
|
| + if ([[alert_ suppressionButton] state] == NSOnState) {
|
| ExternalProtocolHandler::SetBlockState(url_.scheme(), blockState);
|
| + UMA_HISTOGRAM_SPARSE_SLOWLY(
|
| + ExternalProtocolHandler::kRememberCheckedHistogram, 1);
|
| + } else {
|
| + UMA_HISTOGRAM_SPARSE_SLOWLY(
|
| + ExternalProtocolHandler::kRememberCheckedHistogram, 0);
|
| + }
|
|
|
| if (blockState == ExternalProtocolHandler::DONT_BLOCK) {
|
| UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url",
|
|
|