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/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "net/url_request/url_request.h" | 23 #include "net/url_request/url_request.h" |
24 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 24 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
25 | 25 |
26 using webkit_glue::PasswordForm; | 26 using webkit_glue::PasswordForm; |
27 | 27 |
28 // ---------------------------------------------------------------------------- | 28 // ---------------------------------------------------------------------------- |
29 // LoginHandlerMac | 29 // LoginHandlerMac |
30 | 30 |
31 // This class simply forwards the authentication from the LoginView (on | 31 // This class simply forwards the authentication from the LoginView (on |
32 // the UI thread) to the URLRequest (on the I/O thread). | 32 // the UI thread) to the net::URLRequest (on the I/O thread). |
33 // This class uses ref counting to ensure that it lives until all InvokeLaters | 33 // This class uses ref counting to ensure that it lives until all InvokeLaters |
34 // have been called. | 34 // have been called. |
35 class LoginHandlerMac : public LoginHandler, | 35 class LoginHandlerMac : public LoginHandler, |
36 public ConstrainedWindowMacDelegateCustomSheet { | 36 public ConstrainedWindowMacDelegateCustomSheet { |
37 public: | 37 public: |
38 LoginHandlerMac(net::AuthChallengeInfo* auth_info, URLRequest* request) | 38 LoginHandlerMac(net::AuthChallengeInfo* auth_info, net::URLRequest* request) |
39 : LoginHandler(auth_info, request), | 39 : LoginHandler(auth_info, request), |
40 sheet_controller_(nil) { | 40 sheet_controller_(nil) { |
41 } | 41 } |
42 | 42 |
43 virtual ~LoginHandlerMac() { | 43 virtual ~LoginHandlerMac() { |
44 } | 44 } |
45 | 45 |
46 // LoginModelObserver implementation. | 46 // LoginModelObserver implementation. |
47 virtual void OnAutofillDataAvailable(const std::wstring& username, | 47 virtual void OnAutofillDataAvailable(const std::wstring& username, |
48 const std::wstring& password) { | 48 const std::wstring& password) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 friend class LoginPrompt; | 110 friend class LoginPrompt; |
111 | 111 |
112 // The Cocoa controller of the GUI. | 112 // The Cocoa controller of the GUI. |
113 LoginHandlerSheet* sheet_controller_; | 113 LoginHandlerSheet* sheet_controller_; |
114 | 114 |
115 DISALLOW_COPY_AND_ASSIGN(LoginHandlerMac); | 115 DISALLOW_COPY_AND_ASSIGN(LoginHandlerMac); |
116 }; | 116 }; |
117 | 117 |
118 // static | 118 // static |
119 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 119 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
120 URLRequest* request) { | 120 net::URLRequest* request) { |
121 return new LoginHandlerMac(auth_info, request); | 121 return new LoginHandlerMac(auth_info, request); |
122 } | 122 } |
123 | 123 |
124 // ---------------------------------------------------------------------------- | 124 // ---------------------------------------------------------------------------- |
125 // LoginHandlerSheet | 125 // LoginHandlerSheet |
126 | 126 |
127 @implementation LoginHandlerSheet | 127 @implementation LoginHandlerSheet |
128 | 128 |
129 - (id)initWithLoginHandler:(LoginHandlerMac*)handler { | 129 - (id)initWithLoginHandler:(LoginHandlerMac*)handler { |
130 NSString* nibPath = | 130 NSString* nibPath = |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 sizeToFitFixedWidthTextField:explanationField_]; | 182 sizeToFitFixedWidthTextField:explanationField_]; |
183 | 183 |
184 // Resize the window (no shifting needed due to window layout). | 184 // Resize the window (no shifting needed due to window layout). |
185 NSSize windowDelta = NSMakeSize(0, explanationShift); | 185 NSSize windowDelta = NSMakeSize(0, explanationShift); |
186 [GTMUILocalizerAndLayoutTweaker | 186 [GTMUILocalizerAndLayoutTweaker |
187 resizeWindowWithoutAutoResizingSubViews:[self window] | 187 resizeWindowWithoutAutoResizingSubViews:[self window] |
188 delta:windowDelta]; | 188 delta:windowDelta]; |
189 } | 189 } |
190 | 190 |
191 @end | 191 @end |
OLD | NEW |