| 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..48d087f3ded85dfaee9face0654d30e7bf54d73d 100644
|
| --- a/chrome/browser/ui/cocoa/external_protocol_dialog.mm
|
| +++ b/chrome/browser/ui/cocoa/external_protocol_dialog.mm
|
| @@ -6,12 +6,11 @@
|
|
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/metrics/histogram_macros.h"
|
| -#include "base/strings/string_util.h"
|
| -#include "base/strings/utf_string_conversions.h"
|
| #include "chrome/browser/external_protocol/external_protocol_handler.h"
|
| #include "chrome/browser/shell_integration.h"
|
| #include "chrome/grit/chromium_strings.h"
|
| #include "chrome/grit/generated_resources.h"
|
| +#include "components/strings/grit/components_strings.h"
|
| #include "ui/base/l10n/l10n_util_mac.h"
|
| #include "ui/gfx/text_elider.h"
|
|
|
| @@ -61,40 +60,18 @@ 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_ addButtonWithTitle:l10n_util::GetNSStringWithFixup(IDS_CANCEL)];
|
|
|
| [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 +104,12 @@ 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);
|
| + ExternalProtocolHandler::RecordMetrics(true);
|
| + } else {
|
| + ExternalProtocolHandler::RecordMetrics(false);
|
| + }
|
|
|
| if (blockState == ExternalProtocolHandler::DONT_BLOCK) {
|
| UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url",
|
|
|