| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // This class uses ref counting to ensure that it lives until all InvokeLaters | 35 // This class uses ref counting to ensure that it lives until all InvokeLaters |
| 36 // have been called. | 36 // have been called. |
| 37 class LoginHandlerMac : public LoginHandler, | 37 class LoginHandlerMac : public LoginHandler, |
| 38 public ConstrainedWindowMacDelegateCustomSheet { | 38 public ConstrainedWindowMacDelegateCustomSheet { |
| 39 public: | 39 public: |
| 40 LoginHandlerMac(net::AuthChallengeInfo* auth_info, net::URLRequest* request) | 40 LoginHandlerMac(net::AuthChallengeInfo* auth_info, net::URLRequest* request) |
| 41 : LoginHandler(auth_info, request), | 41 : LoginHandler(auth_info, request), |
| 42 sheet_controller_(nil) { | 42 sheet_controller_(nil) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual ~LoginHandlerMac() { | |
| 46 } | |
| 47 | |
| 48 // LoginModelObserver implementation. | 45 // LoginModelObserver implementation. |
| 49 virtual void OnAutofillDataAvailable(const string16& username, | 46 virtual void OnAutofillDataAvailable(const string16& username, |
| 50 const string16& password) { | 47 const string16& password) { |
| 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 48 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 52 | 49 |
| 53 [sheet_controller_ autofillLogin:base::SysUTF16ToNSString(username) | 50 [sheet_controller_ autofillLogin:base::SysUTF16ToNSString(username) |
| 54 password:base::SysUTF16ToNSString(password)]; | 51 password:base::SysUTF16ToNSString(password)]; |
| 55 } | 52 } |
| 56 | 53 |
| 57 // LoginHandler: | 54 // LoginHandler: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 106 |
| 110 void OnCancelPressed() { | 107 void OnCancelPressed() { |
| 111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 112 | 109 |
| 113 CancelAuth(); | 110 CancelAuth(); |
| 114 } | 111 } |
| 115 | 112 |
| 116 private: | 113 private: |
| 117 friend class LoginPrompt; | 114 friend class LoginPrompt; |
| 118 | 115 |
| 116 virtual ~LoginHandlerMac() {} |
| 117 |
| 119 // The Cocoa controller of the GUI. | 118 // The Cocoa controller of the GUI. |
| 120 LoginHandlerSheet* sheet_controller_; | 119 LoginHandlerSheet* sheet_controller_; |
| 121 | 120 |
| 122 DISALLOW_COPY_AND_ASSIGN(LoginHandlerMac); | 121 DISALLOW_COPY_AND_ASSIGN(LoginHandlerMac); |
| 123 }; | 122 }; |
| 124 | 123 |
| 125 // static | 124 // static |
| 126 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 125 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 127 net::URLRequest* request) { | 126 net::URLRequest* request) { |
| 128 return new LoginHandlerMac(auth_info, request); | 127 return new LoginHandlerMac(auth_info, request); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 sizeToFitFixedWidthTextField:explanationField_]; | 189 sizeToFitFixedWidthTextField:explanationField_]; |
| 191 | 190 |
| 192 // Resize the window (no shifting needed due to window layout). | 191 // Resize the window (no shifting needed due to window layout). |
| 193 NSSize windowDelta = NSMakeSize(0, explanationShift); | 192 NSSize windowDelta = NSMakeSize(0, explanationShift); |
| 194 [GTMUILocalizerAndLayoutTweaker | 193 [GTMUILocalizerAndLayoutTweaker |
| 195 resizeWindowWithoutAutoResizingSubViews:[self window] | 194 resizeWindowWithoutAutoResizingSubViews:[self window] |
| 196 delta:windowDelta]; | 195 delta:windowDelta]; |
| 197 } | 196 } |
| 198 | 197 |
| 199 @end | 198 @end |
| OLD | NEW |