From 1bf956b6f611bd3e116489bfdef7ac9048db0308 Mon Sep 17 00:00:00 2001 From: "thomasvl@chromium.org" Date: Mon, 14 Sep 2009 19:25:20 +0000 Subject: 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 --- chrome/app/nibs/HttpAuthLoginSheet.xib | 1172 ++++++++++++++++++++++++++------ chrome/browser/login_prompt_mac.h | 2 + chrome/browser/login_prompt_mac.mm | 28 +- chrome/chrome.gyp | 1 + 4 files changed, 1004 insertions(+), 199 deletions(-) (limited to 'chrome') diff --git a/chrome/app/nibs/HttpAuthLoginSheet.xib b/chrome/app/nibs/HttpAuthLoginSheet.xib index 512eee5..2801f3c 100644 --- a/chrome/app/nibs/HttpAuthLoginSheet.xib +++ b/chrome/app/nibs/HttpAuthLoginSheet.xib @@ -1,14 +1,18 @@ - + 1050 - 9J61 - 677 - 949.46 - 353.00 + 10B504 + 732 + 1038.2 + 437.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 732 + YES - + YES @@ -16,7 +20,7 @@ YES - + YES @@ -37,166 +41,248 @@ 17 2 - {{196, 388}, {353, 122}} + {{196, 388}, {400, 172}} -1543503872 Window NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 256 YES - + - 268 - {{17, 82}, {45, 17}} - - YES - - 68288064 - 272630784 - Name: - - LucidaGrande - 1.300000e+01 - 1044 - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2OQA - - - - 6 - System - controlTextColor - - 3 - MAA + 10 + + YES + + + 256 + + YES + + + 266 + {{6, 10}, {242, 22}} + + YES + + 343014976 + 272630784 + + + LucidaGrande + 13 + 1044 + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + YES + NSAllRomanInputSourcesLocaleIdentifier + + + + + + 266 + {{6, 42}, {242, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + + + + {259, 74} + - - - - 268 - {{17, 50}, {68, 17}} + {{105, 56}, {259, 74}} - YES - - 68288064 - 272630784 - Password: - - - - + {0, 0} + + 67239424 + 0 + + + LucidaGrande + 11 + 3100 + + + + 3 + MCAwLjgwMDAwMDAxMTkAA + + + 0 + 0 + 0 + NO + YES - + - 266 - {{90, 80}, {243, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - 6 - System - textBackgroundColor - - 3 - MQA + 289 + + YES + + + 289 + {{110, 12}, {96, 32}} + + YES + + 67239424 + 134217728 + ^IDS_LOGIN_DIALOG_OK_BUTTON_LABEL + + + -2038284033 + 129 + + DQ + 200 + 25 - - 6 - System - textColor - + + + 289 + {{14, 12}, {96, 32}} + + YES + + 67239424 + 134217728 + ^IDS_CANCEL + + + -2038284033 + 129 + + Gw + 200 + 25 + + {{180, 0}, {220, 52}} + + GTMWidthBasedTweaker - + - 266 - {{90, 48}, {243, 22}} - - YES - - 343014976 - 272630784 - - - - YES - - - - YES - NSAllRomanInputSourcesLocaleIdentifier + 268 + + YES + + + 265 + {{17, 40}, {66, 17}} + + YES + + 68288064 + 272630784 + ^IDS_LOGIN_DIALOG_USERNAME_FIELD + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + + + + + + 265 + {{17, 8}, {66, 17}} + + YES + + 68288064 + 272630784 + ^IDS_LOGIN_DIALOG_PASSWORD_FIELD + + + + + - - - - 289 - {{243, 12}, {96, 32}} + {{20, 60}, {89, 68}} - YES - - 67239424 - 134217728 - Log In - - - -2038284033 - 129 - - DQ - 200 - 25 - + GTMWidthBasedTweaker - + - 289 - {{147, 12}, {96, 32}} + 266 + {{17, 135}, {366, 17}} YES - + 67239424 - 134217728 - Cancel + 272629760 + explanation - - -2038284033 - 129 - - Gw - 200 - 25 + + + - {353, 122} + {400, 172} {{0, 0}, {1440, 878}} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} + + + GTMUILocalizerAndLayoutTweaker + + + ChromeUILocalizer @@ -242,34 +328,72 @@ 23 + + + uiObject_ + + + + 37 + + + + localizer_ + + + + 38 + + + + viewToResize_ + + + + 39 + + + + viewToSlideAndResize_ + + + + 40 + + + + explanationField_ + + + + 45 + YES 0 - - YES - + -2 - - RmlsZSdzIE93bmVyA + + File's Owner -1 - + First Responder -3 - + Application @@ -279,21 +403,91 @@ YES - + 2 YES - + + + + + + + + + 33 + + + YES - - - + + + + + + 13 + + + YES + + + + + + 14 + + + + + 11 + + + YES + + + + + + 12 + + + + + 35 + + + + + 36 + + + + + 41 + + + YES + + + + + + 42 + + + + + 34 + + + YES + - + 3 @@ -302,7 +496,7 @@ YES - + 4 @@ -316,7 +510,7 @@ YES - + 6 @@ -324,27 +518,23 @@ - 7 - + 24 + YES - + + - 8 - - - - 9 YES - + 10 @@ -352,38 +542,24 @@ - 11 - - - YES - - - - - - 12 - - - - - 13 - + 7 + YES - + - + - 14 - - + 8 + + YES - + YES -1.IBPluginDependency -2.IBPluginDependency @@ -398,8 +574,13 @@ 13.IBPluginDependency 14.IBPluginDependency 2.IBPluginDependency + 2.IBUserGuides 3.IBPluginDependency + 35.IBPluginDependency + 36.IBPluginDependency 4.IBPluginDependency + 41.IBPluginDependency + 42.IBPluginDependency 5.IBPluginDependency 6.IBPluginDependency 7.IBPluginDependency @@ -411,9 +592,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{356, 546}, {353, 122}} + {{688, 474}, {400, 172}} com.apple.InterfaceBuilder.CocoaPlugin - {{356, 546}, {353, 122}} + {{688, 474}, {400, 172}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -421,6 +602,13 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + YES + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -432,9 +620,7 @@ YES - - YES - + YES @@ -442,42 +628,97 @@ YES - - YES - + YES - 23 + 45 YES - NSObject + ChromeUILocalizer + GTMUILocalizer IBProjectSource - browser/cocoa/status_bubble_mac.h + browser/cocoa/ui_localizer.h - NSObject + GTMUILocalizer + NSObject + + YES + + YES + otherObjectToLocalize_ + owner_ + yetAnotherObjectToLocalize_ + + + YES + id + id + id + + IBProjectSource - browser/cocoa/tab_strip_model_observer_bridge.h + ../third_party/GTM/AppKit/GTMUILocalizer.h - - - YES + + GTMUILocalizerAndLayoutTweaker + NSObject + + YES + + YES + localizerOwner_ + localizer_ + uiObject_ + + + YES + id + GTMUILocalizer + id + + + + IBProjectSource + ../third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h + + + + GTMWidthBasedTweaker + NSView + + YES + + YES + viewToResize_ + viewToSlideAndResize_ + viewToSlide_ + + + YES + id + NSView + NSView + + + + LoginHandlerSheet NSWindowController YES - + YES cancelPressed: loginPressed: @@ -490,25 +731,562 @@ YES - + YES + explanationField_ nameField_ passwordField_ YES NSTextField + NSTextField NSSecureTextField - IBDocumentRelativeSource - ../../browser/login_prompt_mac.h + IBProjectSource + browser/login_prompt_mac.h + + + + NSObject + + IBProjectSource + browser/cocoa/status_bubble_mac.h + + + + NSObject + + IBProjectSource + browser/cocoa/tab_strip_model_observer_bridge.h - - 0 + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSBox + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSBox.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CIImageProvider.h + + + + NSObject + + IBFrameworkSource + SecurityInterface.framework/Headers/SFAuthorizationView.h + + + + NSObject + + IBFrameworkSource + SecurityInterface.framework/Headers/SFCertificatePanel.h + + + + NSObject + + IBFrameworkSource + SecurityInterface.framework/Headers/SFChooseIdentityPanel.h + + + + NSPanel + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSPanel.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSSecureTextField + NSTextField + + IBFrameworkSource + AppKit.framework/Headers/NSSecureTextField.h + + + + NSSecureTextFieldCell + NSTextFieldCell + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES ../../chrome.xcodeproj 3 diff --git a/chrome/browser/login_prompt_mac.h b/chrome/browser/login_prompt_mac.h index 28e8c38..ae44f4a 100644 --- a/chrome/browser/login_prompt_mac.h +++ b/chrome/browser/login_prompt_mac.h @@ -15,6 +15,7 @@ class LoginHandlerMac; @private IBOutlet NSTextField* nameField_; IBOutlet NSSecureTextField* passwordField_; + IBOutlet NSTextField* explanationField_; LoginHandlerMac* handler_; // weak, owns us } - (id)initWithLoginHandler:(LoginHandlerMac*)handler; @@ -24,6 +25,7 @@ class LoginHandlerMac; returnCode:(int)returnCode contextInfo:(void*)contextInfo; - (void)autofillLogin:(NSString*)login password:(NSString*)password; +- (void)setExplanation:(NSString*)explanation; @end #endif // CHROME_BROWSER_LOGIN_PROMPT_MAC_H_ 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 diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index cc40b41..53b8c17 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -2339,6 +2339,7 @@ 'app/nibs/ClearBrowsingData.xib', 'app/nibs/EditSearchEngine.xib', 'app/nibs/FirstRunDialog.xib', + 'app/nibs/HttpAuthLoginSheet.xib', 'app/nibs/HungRendererDialog.xib', 'app/nibs/ImportProgressDialog.xib', 'app/nibs/KeywordEditor.xib', -- cgit v1.1