| 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 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "chrome/browser/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
| 9 #include "chrome/browser/password_manager/password_manager.h" | 9 #include "chrome/browser/password_manager/password_manager.h" |
| 10 #include "chrome/browser/renderer_host/render_process_host.h" | 10 #include "chrome/browser/renderer_host/render_process_host.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // ---------------------------------------------------------------------------- | 24 // ---------------------------------------------------------------------------- |
| 25 // LoginHandlerWin | 25 // LoginHandlerWin |
| 26 | 26 |
| 27 // This class simply forwards the authentication from the LoginView (on | 27 // This class simply forwards the authentication from the LoginView (on |
| 28 // the UI thread) to the URLRequest (on the I/O thread). | 28 // the UI thread) to the URLRequest (on the I/O thread). |
| 29 // This class uses ref counting to ensure that it lives until all InvokeLaters | 29 // This class uses ref counting to ensure that it lives until all InvokeLaters |
| 30 // have been called. | 30 // have been called. |
| 31 class LoginHandlerWin : public LoginHandler, | 31 class LoginHandlerWin : public LoginHandler, |
| 32 public ConstrainedDialogDelegate { | 32 public ConstrainedDialogDelegate { |
| 33 public: | 33 public: |
| 34 explicit LoginHandlerWin(URLRequest* request) : LoginHandler(request) { | 34 LoginHandlerWin(net::AuthChallengeInfo* auth_info, URLRequest* request) |
| 35 : LoginHandler(auth_info, request) { |
| 35 } | 36 } |
| 36 | 37 |
| 37 // LoginModelObserver implementation. | 38 // LoginModelObserver implementation. |
| 38 virtual void OnAutofillDataAvailable(const std::wstring& username, | 39 virtual void OnAutofillDataAvailable(const std::wstring& username, |
| 39 const std::wstring& password) { | 40 const std::wstring& password) { |
| 40 // Nothing to do here since LoginView takes care of autofil for win. | 41 // Nothing to do here since LoginView takes care of autofil for win. |
| 41 } | 42 } |
| 42 | 43 |
| 43 void set_login_view(LoginView* login_view) { | 44 void set_login_view(LoginView* login_view) { |
| 44 login_view_ = login_view; | 45 login_view_ = login_view; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 view->SetModel(manager); | 113 view->SetModel(manager); |
| 113 | 114 |
| 114 set_login_view(view); | 115 set_login_view(view); |
| 115 | 116 |
| 116 // Scary thread safety note: This can potentially be called *after* SetAuth | 117 // Scary thread safety note: This can potentially be called *after* SetAuth |
| 117 // or CancelAuth (say, if the request was cancelled before the UI thread got | 118 // or CancelAuth (say, if the request was cancelled before the UI thread got |
| 118 // control). However, that's OK since any UI interaction in those functions | 119 // control). However, that's OK since any UI interaction in those functions |
| 119 // will occur via an InvokeLater on the UI thread, which is guaranteed | 120 // will occur via an InvokeLater on the UI thread, which is guaranteed |
| 120 // to happen after this is called (since this was InvokeLater'd first). | 121 // to happen after this is called (since this was InvokeLater'd first). |
| 121 SetDialog(GetTabContentsForLogin()->CreateConstrainedDialog(this)); | 122 SetDialog(GetTabContentsForLogin()->CreateConstrainedDialog(this)); |
| 122 SendNotifications(); | 123 NotifyAuthNeeded(); |
| 123 } | 124 } |
| 124 | 125 |
| 125 private: | 126 private: |
| 126 friend class base::RefCountedThreadSafe<LoginHandlerWin>; | 127 friend class base::RefCountedThreadSafe<LoginHandlerWin>; |
| 127 friend class LoginPrompt; | 128 friend class LoginPrompt; |
| 128 | 129 |
| 129 ~LoginHandlerWin() {} | 130 ~LoginHandlerWin() {} |
| 130 | 131 |
| 131 // The LoginView that contains the user's login information | 132 // The LoginView that contains the user's login information |
| 132 LoginView* login_view_; | 133 LoginView* login_view_; |
| 133 | 134 |
| 134 DISALLOW_COPY_AND_ASSIGN(LoginHandlerWin); | 135 DISALLOW_COPY_AND_ASSIGN(LoginHandlerWin); |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 // static | 138 // static |
| 138 LoginHandler* LoginHandler::Create(URLRequest* request) { | 139 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 139 return new LoginHandlerWin(request); | 140 URLRequest* request) { |
| 141 return new LoginHandlerWin(auth_info, request); |
| 140 } | 142 } |
| OLD | NEW |