| 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 <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // ---------------------------------------------------------------------------- | 26 // ---------------------------------------------------------------------------- |
| 27 // LoginHandlerGtk | 27 // LoginHandlerGtk |
| 28 | 28 |
| 29 // This class simply forwards the authentication from the LoginView (on | 29 // This class simply forwards the authentication from the LoginView (on |
| 30 // the UI thread) to the URLRequest (on the I/O thread). | 30 // the UI thread) to the URLRequest (on the I/O thread). |
| 31 // This class uses ref counting to ensure that it lives until all InvokeLaters | 31 // This class uses ref counting to ensure that it lives until all InvokeLaters |
| 32 // have been called. | 32 // have been called. |
| 33 class LoginHandlerGtk : public LoginHandler, | 33 class LoginHandlerGtk : public LoginHandler, |
| 34 public ConstrainedWindowGtkDelegate { | 34 public ConstrainedWindowGtkDelegate { |
| 35 public: | 35 public: |
| 36 explicit LoginHandlerGtk(URLRequest* request) : LoginHandler(request) { | 36 LoginHandlerGtk(net::AuthChallengeInfo* auth_info, URLRequest* request) |
| 37 : LoginHandler(auth_info, request) { |
| 37 } | 38 } |
| 38 | 39 |
| 39 virtual ~LoginHandlerGtk() { | 40 virtual ~LoginHandlerGtk() { |
| 40 root_.Destroy(); | 41 root_.Destroy(); |
| 41 } | 42 } |
| 42 | 43 |
| 43 // LoginModelObserver implementation. | 44 // LoginModelObserver implementation. |
| 44 virtual void OnAutofillDataAvailable(const std::wstring& username, | 45 virtual void OnAutofillDataAvailable(const std::wstring& username, |
| 45 const std::wstring& password) { | 46 const std::wstring& password) { |
| 46 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 47 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 101 |
| 101 SetModel(manager); | 102 SetModel(manager); |
| 102 | 103 |
| 103 // Scary thread safety note: This can potentially be called *after* SetAuth | 104 // Scary thread safety note: This can potentially be called *after* SetAuth |
| 104 // or CancelAuth (say, if the request was cancelled before the UI thread got | 105 // or CancelAuth (say, if the request was cancelled before the UI thread got |
| 105 // control). However, that's OK since any UI interaction in those functions | 106 // control). However, that's OK since any UI interaction in those functions |
| 106 // will occur via an InvokeLater on the UI thread, which is guaranteed | 107 // will occur via an InvokeLater on the UI thread, which is guaranteed |
| 107 // to happen after this is called (since this was InvokeLater'd first). | 108 // to happen after this is called (since this was InvokeLater'd first). |
| 108 SetDialog(GetTabContentsForLogin()->CreateConstrainedDialog(this)); | 109 SetDialog(GetTabContentsForLogin()->CreateConstrainedDialog(this)); |
| 109 | 110 |
| 110 SendNotifications(); | 111 NotifyAuthNeeded(); |
| 111 } | 112 } |
| 112 | 113 |
| 113 // Overridden from ConstrainedWindowGtkDelegate: | 114 // Overridden from ConstrainedWindowGtkDelegate: |
| 114 virtual GtkWidget* GetWidgetRoot() { | 115 virtual GtkWidget* GetWidgetRoot() { |
| 115 return root_.get(); | 116 return root_.get(); |
| 116 } | 117 } |
| 117 | 118 |
| 118 virtual void DeleteDelegate() { | 119 virtual void DeleteDelegate() { |
| 119 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 120 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 120 | 121 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 164 |
| 164 // GtkEntry widgets that the user types into. | 165 // GtkEntry widgets that the user types into. |
| 165 GtkWidget* username_entry_; | 166 GtkWidget* username_entry_; |
| 166 GtkWidget* password_entry_; | 167 GtkWidget* password_entry_; |
| 167 GtkWidget* ok_; | 168 GtkWidget* ok_; |
| 168 | 169 |
| 169 DISALLOW_COPY_AND_ASSIGN(LoginHandlerGtk); | 170 DISALLOW_COPY_AND_ASSIGN(LoginHandlerGtk); |
| 170 }; | 171 }; |
| 171 | 172 |
| 172 // static | 173 // static |
| 173 LoginHandler* LoginHandler::Create(URLRequest* request) { | 174 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 174 return new LoginHandlerGtk(request); | 175 URLRequest* request) { |
| 176 return new LoginHandlerGtk(auth_info, request); |
| 175 } | 177 } |
| OLD | NEW |