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

Unified Diff: ios/chrome/browser/ui/dialogs/dialog_presenter.mm

Issue 2944243002: Improve dialog titles generated by embedded pages. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/dialogs/dialog_presenter.mm
diff --git a/ios/chrome/browser/ui/dialogs/dialog_presenter.mm b/ios/chrome/browser/ui/dialogs/dialog_presenter.mm
index 1d7094f85022a5d80460a8bc6ed0ddd9b0abf825..2ea10d5afd4f93264abcdb95ebe973e8ca6afe67 100644
--- a/ios/chrome/browser/ui/dialogs/dialog_presenter.mm
+++ b/ios/chrome/browser/ui/dialogs/dialog_presenter.mm
@@ -31,12 +31,6 @@
NSString* const kJavaScriptDialogTextFieldAccessibiltyIdentifier =
@"JavaScriptDialogTextFieldAccessibiltyIdentifier";
-namespace {
-// The hostname to use for JavaScript alerts when there is no valid hostname in
-// the URL passed to |+localizedTitleForJavaScriptAlertFromPage:type:|.
-const char kAboutNullHostname[] = "about:null";
-} // namespace
-
@interface DialogPresenter () {
// Queue of WebStates which correspond to the keys in
// |_dialogCoordinatorsForWebStates|.
@@ -347,11 +341,16 @@ const char kAboutNullHostname[] = "about:null";
}
+ (NSString*)localizedTitleForJavaScriptAlertFromPage:(const GURL&)pageURL {
+ NSString* localizedTitle = nil;
NSString* hostname = base::SysUTF8ToNSString(pageURL.host());
- if (!hostname.length)
- hostname = base::SysUTF8ToNSString(kAboutNullHostname);
- return l10n_util::GetNSStringF(IDS_JAVASCRIPT_MESSAGEBOX_TITLE,
- base::SysNSStringToUTF16(hostname));
+ if (!hostname.length) {
Eugene But (OOO till 7-30) 2017/06/22 20:19:12 Other platforms use IDS_JAVASCRIPT_MESSAGEBOX_TITL
+ localizedTitle = l10n_util::GetNSString(
+ IDS_JAVASCRIPT_MESSAGEBOX_TITLE_NONSTANDARD_URL_IFRAME);
+ } else {
+ localizedTitle = l10n_util::GetNSStringF(
+ IDS_JAVASCRIPT_MESSAGEBOX_TITLE, base::SysNSStringToUTF16(hostname));
+ }
+ return localizedTitle;
}
#pragma mark - Private methods.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698