| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/login/login_prompt.h" | 5 #include "chrome/browser/ui/login/login_prompt.h" |
| 6 #import "chrome/browser/ui/login/login_prompt_mac.h" | 6 #import "chrome/browser/ui/login/login_prompt_mac.h" |
| 7 | 7 |
| 8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/string16.h" |
| 9 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 10 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/password_manager/password_manager.h" | 13 #include "chrome/browser/password_manager/password_manager.h" |
| 13 #include "chrome/browser/tab_contents/tab_util.h" | 14 #include "chrome/browser/tab_contents/tab_util.h" |
| 14 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" | 15 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" |
| 15 #include "chrome/browser/ui/login/login_model.h" | 16 #include "chrome/browser/ui/login/login_model.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 17 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 18 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 18 #include "content/browser/tab_contents/navigation_controller.h" | 19 #include "content/browser/tab_contents/navigation_controller.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 37 public: | 38 public: |
| 38 LoginHandlerMac(net::AuthChallengeInfo* auth_info, net::URLRequest* request) | 39 LoginHandlerMac(net::AuthChallengeInfo* auth_info, net::URLRequest* request) |
| 39 : LoginHandler(auth_info, request), | 40 : LoginHandler(auth_info, request), |
| 40 sheet_controller_(nil) { | 41 sheet_controller_(nil) { |
| 41 } | 42 } |
| 42 | 43 |
| 43 virtual ~LoginHandlerMac() { | 44 virtual ~LoginHandlerMac() { |
| 44 } | 45 } |
| 45 | 46 |
| 46 // LoginModelObserver implementation. | 47 // LoginModelObserver implementation. |
| 47 virtual void OnAutofillDataAvailable(const std::wstring& username, | 48 virtual void OnAutofillDataAvailable(const string16& username, |
| 48 const std::wstring& password) { | 49 const string16& password) { |
| 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 50 | 51 |
| 51 [sheet_controller_ autofillLogin:base::SysWideToNSString(username) | 52 [sheet_controller_ autofillLogin:base::SysUTF16ToNSString(username) |
| 52 password:base::SysWideToNSString(password)]; | 53 password:base::SysUTF16ToNSString(password)]; |
| 53 } | 54 } |
| 54 | 55 |
| 55 // LoginHandler: | 56 // LoginHandler: |
| 56 virtual void BuildViewForPasswordManager(PasswordManager* manager, | 57 virtual void BuildViewForPasswordManager(PasswordManager* manager, |
| 57 const string16& explanation) { | 58 const string16& explanation) { |
| 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 59 | 60 |
| 60 // Load nib here instead of in constructor. | 61 // Load nib here instead of in constructor. |
| 61 sheet_controller_ = [[[LoginHandlerSheet alloc] | 62 sheet_controller_ = [[[LoginHandlerSheet alloc] |
| 62 initWithLoginHandler:this] autorelease]; | 63 initWithLoginHandler:this] autorelease]; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 sizeToFitFixedWidthTextField:explanationField_]; | 189 sizeToFitFixedWidthTextField:explanationField_]; |
| 189 | 190 |
| 190 // Resize the window (no shifting needed due to window layout). | 191 // Resize the window (no shifting needed due to window layout). |
| 191 NSSize windowDelta = NSMakeSize(0, explanationShift); | 192 NSSize windowDelta = NSMakeSize(0, explanationShift); |
| 192 [GTMUILocalizerAndLayoutTweaker | 193 [GTMUILocalizerAndLayoutTweaker |
| 193 resizeWindowWithoutAutoResizingSubViews:[self window] | 194 resizeWindowWithoutAutoResizingSubViews:[self window] |
| 194 delta:windowDelta]; | 195 delta:windowDelta]; |
| 195 } | 196 } |
| 196 | 197 |
| 197 @end | 198 @end |
| OLD | NEW |