summaryrefslogtreecommitdiffstats
path: root/chrome/browser/login_prompt_mac.mm
diff options
context:
space:
mode:
authorthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-14 19:25:20 +0000
committerthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-14 19:25:20 +0000
commit1bf956b6f611bd3e116489bfdef7ac9048db0308 (patch)
treef3b14d4f2cd2cdec5f6d6fe367880083ca1b94d1 /chrome/browser/login_prompt_mac.mm
parentc0ba2a0d704149385556397589de783130ea6d2f (diff)
downloadchromium_src-1bf956b6f611bd3e116489bfdef7ac9048db0308.zip
chromium_src-1bf956b6f611bd3e116489bfdef7ac9048db0308.tar.gz
chromium_src-1bf956b6f611bd3e116489bfdef7ac9048db0308.tar.bz2
Load the http auth dialog from the main bundle.
Localize the http auth dialog. Add the explanation to the http auth dialog. Autosize the http auth dialog after putting in the explanation. TEST=http auto ui should now be localized. BUG=20532 Review URL: http://codereview.chromium.org/196109 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26140 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/login_prompt_mac.mm')
-rw-r--r--chrome/browser/login_prompt_mac.mm28
1 files changed, 26 insertions, 2 deletions
diff --git a/chrome/browser/login_prompt_mac.mm b/chrome/browser/login_prompt_mac.mm
index db3569b..2264c26 100644
--- a/chrome/browser/login_prompt_mac.mm
+++ b/chrome/browser/login_prompt_mac.mm
@@ -19,6 +19,7 @@
#include "chrome/common/notification_service.h"
#include "grit/generated_resources.h"
#include "net/url_request/url_request.h"
+#include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
using webkit_glue::PasswordForm;
@@ -89,6 +90,8 @@ class LoginHandlerMac : public LoginHandler,
SetModel(manager);
+ [sheet_controller_ setExplanation:base::SysWideToNSString(explanation)];
+
// Scary thread safety note: This can potentially be called *after* SetAuth
// or CancelAuth (say, if the request was cancelled before the UI thread got
// control). However, that's OK since any UI interaction in those functions
@@ -312,8 +315,11 @@ LoginHandler* LoginHandler::Create(URLRequest* request, MessageLoop* ui_loop) {
@implementation LoginHandlerSheet
- (id)initWithLoginHandler:(LoginHandlerMac*)handler {
- if ((self = [super initWithWindowNibName:@"HttpAuthLoginSheet"
- owner:self])) {
+ NSString* nibPath =
+ [mac_util::MainAppBundle() pathForResource:@"HttpAuthLoginSheet"
+ ofType:@"nib"];
+ if ((self = [super initWithWindowNibPath:nibPath
+ owner:self])) {
handler_ = handler;
}
return self;
@@ -346,4 +352,22 @@ LoginHandler* LoginHandler::Create(URLRequest* request, MessageLoop* ui_loop) {
}
}
+- (void)setExplanation:(NSString*)explanation {
+ // Put in the text.
+ [explanationField_ setStringValue:explanation];
+
+ // Resize the TextField.
+ CGFloat explanationShift =
+ [GTMUILocalizerAndLayoutTweaker
+ sizeToFitFixedWidthTextField:explanationField_];
+
+ // Resize the window (no shifting needed due to window layout).
+ NSWindow* window = [self window];
+ [[window contentView] setAutoresizesSubviews:NO];
+ NSRect rect = [window frame];
+ rect.size.height = rect.size.height + explanationShift;
+ [window setFrame:rect display:NO];
+ [[window contentView] setAutoresizesSubviews:YES];
+}
+
@end