| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/external_protocol_dialog.h" | 5 #import "chrome/browser/ui/cocoa/external_protocol_dialog.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 NSButton* allowButton = [alert_ addButtonWithTitle: | 65 NSButton* allowButton = [alert_ addButtonWithTitle: |
| 66 l10n_util::GetNSStringWithFixup(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT)]; | 66 l10n_util::GetNSStringWithFixup(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT)]; |
| 67 [allowButton setKeyEquivalent:@""]; // disallow as default | 67 [allowButton setKeyEquivalent:@""]; // disallow as default |
| 68 [alert_ addButtonWithTitle: | 68 [alert_ addButtonWithTitle: |
| 69 l10n_util::GetNSStringWithFixup( | 69 l10n_util::GetNSStringWithFixup( |
| 70 IDS_EXTERNAL_PROTOCOL_CANCEL_BUTTON_TEXT)]; | 70 IDS_EXTERNAL_PROTOCOL_CANCEL_BUTTON_TEXT)]; |
| 71 | 71 |
| 72 const int kMaxUrlWithoutSchemeSize = 256; | 72 const int kMaxUrlWithoutSchemeSize = 256; |
| 73 base::string16 elided_url_without_scheme; | 73 base::string16 elided_url_without_scheme; |
| 74 gfx::ElideString(ASCIIToUTF16(url_.possibly_invalid_spec()), | 74 gfx::ElideString(base::ASCIIToUTF16(url_.possibly_invalid_spec()), |
| 75 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); | 75 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); |
| 76 | 76 |
| 77 NSString* urlString = l10n_util::GetNSStringFWithFixup( | 77 NSString* urlString = l10n_util::GetNSStringFWithFixup( |
| 78 IDS_EXTERNAL_PROTOCOL_INFORMATION, | 78 IDS_EXTERNAL_PROTOCOL_INFORMATION, |
| 79 ASCIIToUTF16(url_.scheme() + ":"), | 79 base::ASCIIToUTF16(url_.scheme() + ":"), |
| 80 elided_url_without_scheme); | 80 elided_url_without_scheme); |
| 81 NSString* appString = l10n_util::GetNSStringFWithFixup( | 81 NSString* appString = l10n_util::GetNSStringFWithFixup( |
| 82 IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, | 82 IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, |
| 83 appName); | 83 appName); |
| 84 NSString* warningString = | 84 NSString* warningString = |
| 85 l10n_util::GetNSStringWithFixup(IDS_EXTERNAL_PROTOCOL_WARNING); | 85 l10n_util::GetNSStringWithFixup(IDS_EXTERNAL_PROTOCOL_WARNING); |
| 86 NSString* informativeText = | 86 NSString* informativeText = |
| 87 [NSString stringWithFormat:@"%@\n\n%@\n\n%@", | 87 [NSString stringWithFormat:@"%@\n\n%@\n\n%@", |
| 88 urlString, | 88 urlString, |
| 89 appString, | 89 appString, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 154 } |
| 155 NSString* appPath = [(NSURL*)openingApp path]; | 155 NSString* appPath = [(NSURL*)openingApp path]; |
| 156 CFRelease(openingApp); // NOT A BUG; LSGetApplicationForURL retains for us | 156 CFRelease(openingApp); // NOT A BUG; LSGetApplicationForURL retains for us |
| 157 NSString* appDisplayName = | 157 NSString* appDisplayName = |
| 158 [[NSFileManager defaultManager] displayNameAtPath:appPath]; | 158 [[NSFileManager defaultManager] displayNameAtPath:appPath]; |
| 159 | 159 |
| 160 return base::SysNSStringToUTF16(appDisplayName); | 160 return base::SysNSStringToUTF16(appDisplayName); |
| 161 } | 161 } |
| 162 | 162 |
| 163 @end | 163 @end |
| OLD | NEW |