| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/login_prompt.h" | 5 #include "chrome/browser/login_prompt.h" |
| 6 #import "chrome/browser/login_prompt_mac.h" | 6 #import "chrome/browser/login_prompt_mac.h" |
| 7 | 7 |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const std::wstring& password) { | 75 const std::wstring& password) { |
| 76 [sheet_controller_ autofillLogin:base::SysWideToNSString(username) | 76 [sheet_controller_ autofillLogin:base::SysWideToNSString(username) |
| 77 password:base::SysWideToNSString(password)]; | 77 password:base::SysWideToNSString(password)]; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // LoginHandler: | 80 // LoginHandler: |
| 81 virtual void BuildViewForPasswordManager(PasswordManager* manager, | 81 virtual void BuildViewForPasswordManager(PasswordManager* manager, |
| 82 std::wstring explanation) { | 82 std::wstring explanation) { |
| 83 DCHECK(MessageLoop::current() == ui_loop_); | 83 DCHECK(MessageLoop::current() == ui_loop_); |
| 84 | 84 |
| 85 TabContents* requesting_contents = GetTabContentsForLogin(); |
| 86 DCHECK(requesting_contents); |
| 87 |
| 88 // If something goes wrong (e.g., there's already a tab-modal sheet up), |
| 89 // cancel the authorization. |
| 90 if (!requesting_contents || |
| 91 !requesting_contents->CanCreateConstrainedDialog()) { |
| 92 CancelAuth(); |
| 93 return; |
| 94 } |
| 95 |
| 85 // Load nib here instead of in constructor. | 96 // Load nib here instead of in constructor. |
| 86 sheet_controller_ = [[[LoginHandlerSheet alloc] | 97 sheet_controller_ = [[[LoginHandlerSheet alloc] |
| 87 initWithLoginHandler:this] autorelease]; | 98 initWithLoginHandler:this] autorelease]; |
| 88 init([sheet_controller_ window], sheet_controller_, | 99 init([sheet_controller_ window], sheet_controller_, |
| 89 @selector(sheetDidEnd:returnCode:contextInfo:)); | 100 @selector(sheetDidEnd:returnCode:contextInfo:)); |
| 90 | 101 |
| 91 SetModel(manager); | 102 SetModel(manager); |
| 92 | 103 |
| 93 [sheet_controller_ setExplanation:base::SysWideToNSString(explanation)]; | 104 [sheet_controller_ setExplanation:base::SysWideToNSString(explanation)]; |
| 94 | 105 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 sizeToFitFixedWidthTextField:explanationField_]; | 373 sizeToFitFixedWidthTextField:explanationField_]; |
| 363 | 374 |
| 364 // Resize the window (no shifting needed due to window layout). | 375 // Resize the window (no shifting needed due to window layout). |
| 365 NSSize windowDelta = NSMakeSize(0, explanationShift); | 376 NSSize windowDelta = NSMakeSize(0, explanationShift); |
| 366 [GTMUILocalizerAndLayoutTweaker | 377 [GTMUILocalizerAndLayoutTweaker |
| 367 resizeWindowWithoutAutoResizingSubViews:[self window] | 378 resizeWindowWithoutAutoResizingSubViews:[self window] |
| 368 delta:windowDelta]; | 379 delta:windowDelta]; |
| 369 } | 380 } |
| 370 | 381 |
| 371 @end | 382 @end |
| OLD | NEW |