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

Unified Diff: chrome/browser/ui/cocoa/login_prompt_cocoa.mm

Issue 1466473003: Do not show untrustworthy strings in the basic auth dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix XIB. Created 5 years 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/ui/cocoa/login_prompt_cocoa.h ('k') | chrome/browser/ui/login/login_prompt.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/login_prompt_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/login_prompt_cocoa.mm b/chrome/browser/ui/cocoa/login_prompt_cocoa.mm
index 4ba6292430185bc2a1123091a1e953957cbe772b..549c11aac7d4396a7afb2b4a3951750710d3d6c5 100644
--- a/chrome/browser/ui/cocoa/login_prompt_cocoa.mm
+++ b/chrome/browser/ui/cocoa/login_prompt_cocoa.mm
@@ -52,7 +52,8 @@ class LoginHandlerMac : public LoginHandler,
void OnLoginModelDestroying() override {}
// LoginHandler:
- void BuildViewImpl(const base::string16& explanation,
+ void BuildViewImpl(const base::string16& authority,
+ const base::string16& explanation,
LoginModelData* login_model_data) override {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -64,6 +65,7 @@ class LoginHandlerMac : public LoginHandler,
else
ResetModel();
+ [sheet_controller_ setAuthority:base::SysUTF16ToNSString(authority)];
[sheet_controller_ setExplanation:base::SysUTF16ToNSString(explanation)];
// Scary thread safety note: This can potentially be called *after* SetAuth
@@ -180,8 +182,19 @@ LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info,
}
}
+- (void)setAuthority:(NSString*)authority {
+ [authorityField_ setStringValue:authority];
+
+ // Resize the text field.
+ CGFloat windowDelta = [GTMUILocalizerAndLayoutTweaker
+ sizeToFitFixedWidthTextField:authorityField_];
+
+ NSRect newFrame = [[self window] frame];
+ newFrame.size.height += windowDelta;
+ [[self window] setFrame:newFrame display:NO];
+}
+
- (void)setExplanation:(NSString*)explanation {
- // Put in the text.
[explanationField_ setStringValue:explanation];
// Resize the text field.
« no previous file with comments | « chrome/browser/ui/cocoa/login_prompt_cocoa.h ('k') | chrome/browser/ui/login/login_prompt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698