| 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_handler.h" | 5 #include "chrome/browser/ui/login/login_handler.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/browser/ui/views/login_view.h" | 11 #include "chrome/browser/ui/views/login_view.h" |
| 11 #include "components/constrained_window/constrained_window_views.h" | 12 #include "components/constrained_window/constrained_window_views.h" |
| 12 #include "components/password_manager/core/browser/password_manager.h" | 13 #include "components/password_manager/core/browser/password_manager.h" |
| 13 #include "components/strings/grit/components_strings.h" | 14 #include "components/strings/grit/components_strings.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
| 16 #include "content/public/browser/render_widget_host.h" | 17 #include "content/public/browser/render_widget_host.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 18 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 21 #include "ui/views/window/dialog_delegate.h" | 22 #include "ui/views/window/dialog_delegate.h" |
| 22 | 23 |
| 23 // ---------------------------------------------------------------------------- | 24 // ---------------------------------------------------------------------------- |
| 24 // LoginHandlerViews | 25 // LoginHandlerViews |
| 25 | 26 |
| 26 // This class simply forwards the authentication from the LoginView (on | 27 // This class simply forwards the authentication from the LoginView (on |
| 27 // the UI thread) to the net::URLRequest (on the I/O thread). | 28 // the UI thread) to the net::URLRequest (on the I/O thread). |
| 28 // 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 |
| 29 // have been called. | 30 // have been called. |
| 30 class LoginHandlerViews : public LoginHandler, public views::DialogDelegate { | 31 class LoginHandlerViews : public LoginHandler, public views::DialogDelegate { |
| 31 public: | 32 public: |
| 32 LoginHandlerViews(net::AuthChallengeInfo* auth_info, net::URLRequest* request) | 33 LoginHandlerViews(net::AuthChallengeInfo* auth_info, net::URLRequest* request) |
| 33 : LoginHandler(auth_info, request), | 34 : LoginHandler(auth_info, request), |
| 34 login_view_(NULL), | 35 login_view_(NULL), |
| 35 dialog_(NULL) { | 36 dialog_(NULL) { |
| 37 chrome::RecordDialogCreation(chrome::DialogIdentifier::LOGIN_HANDLER); |
| 36 } | 38 } |
| 37 | 39 |
| 38 // LoginModelObserver: | 40 // LoginModelObserver: |
| 39 void OnAutofillDataAvailableInternal( | 41 void OnAutofillDataAvailableInternal( |
| 40 const base::string16& username, | 42 const base::string16& username, |
| 41 const base::string16& password) override { | 43 const base::string16& password) override { |
| 42 // Nothing to do here since LoginView takes care of autofill for win. | 44 // Nothing to do here since LoginView takes care of autofill for win. |
| 43 } | 45 } |
| 44 void OnLoginModelDestroying() override {} | 46 void OnLoginModelDestroying() override {} |
| 45 | 47 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 }; | 146 }; |
| 145 | 147 |
| 146 namespace chrome { | 148 namespace chrome { |
| 147 | 149 |
| 148 LoginHandler* CreateLoginHandlerViews(net::AuthChallengeInfo* auth_info, | 150 LoginHandler* CreateLoginHandlerViews(net::AuthChallengeInfo* auth_info, |
| 149 net::URLRequest* request) { | 151 net::URLRequest* request) { |
| 150 return new LoginHandlerViews(auth_info, request); | 152 return new LoginHandlerViews(auth_info, request); |
| 151 } | 153 } |
| 152 | 154 |
| 153 } // namespace chrome | 155 } // namespace chrome |
| OLD | NEW |