| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_VIEWS_LOGIN_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOGIN_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOGIN_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOGIN_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/ui/login/login_prompt.h" | 9 #include "chrome/browser/ui/login/login_prompt.h" |
| 10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
| 11 #include "components/password_manager/core/browser/login_model.h" | 11 #include "components/password_manager/core/browser/login_model.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 class Label; | 15 class Label; |
| 16 class Textfield; | 16 class Textfield; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // This class is responsible for displaying the contents of a login window | 19 // This class is responsible for displaying the contents of a login window |
| 20 // for HTTP/FTP authentication. | 20 // for HTTP/FTP authentication. |
| 21 class LoginView : public views::View, | 21 class LoginView : public views::View, |
| 22 public password_manager::LoginModelObserver { | 22 public password_manager::LoginModelObserver { |
| 23 public: | 23 public: |
| 24 // |login_model_data->model| is observed for the entire lifetime of the | 24 // |login_model_data->model| is observed for the entire lifetime of the |
| 25 // LoginView. Therefore |login_model_data->model| should not be destroyed | 25 // LoginView. Therefore |login_model_data->model| should not be destroyed |
| 26 // before the LoginView object. |login_model_data| may be null. | 26 // before the LoginView object. |login_model_data| may be null. |
| 27 LoginView(const base::string16& explanation, | 27 LoginView(const base::string16& authority, |
| 28 const base::string16& explanation, |
| 28 LoginHandler::LoginModelData* login_model_data); | 29 LoginHandler::LoginModelData* login_model_data); |
| 29 ~LoginView() override; | 30 ~LoginView() override; |
| 30 | 31 |
| 31 // Access the data in the username/password text fields. | 32 // Access the data in the username/password text fields. |
| 32 const base::string16& GetUsername() const; | 33 const base::string16& GetUsername() const; |
| 33 const base::string16& GetPassword() const; | 34 const base::string16& GetPassword() const; |
| 34 | 35 |
| 35 // password_manager::LoginModelObserver: | 36 // password_manager::LoginModelObserver: |
| 36 void OnAutofillDataAvailableInternal(const base::string16& username, | 37 void OnAutofillDataAvailableInternal(const base::string16& username, |
| 37 const base::string16& password) override; | 38 const base::string16& password) override; |
| 38 void OnLoginModelDestroying() override; | 39 void OnLoginModelDestroying() override; |
| 39 | 40 |
| 40 // Used by LoginHandlerWin to set the initial focus. | 41 // Used by LoginHandlerWin to set the initial focus. |
| 41 views::View* GetInitiallyFocusedView(); | 42 views::View* GetInitiallyFocusedView(); |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 // views::View: | 45 // views::View: |
| 45 const char* GetClassName() const override; | 46 const char* GetClassName() const override; |
| 46 | 47 |
| 47 // Non-owning refs to the input text fields. | 48 // Non-owning refs to the input text fields. |
| 48 views::Textfield* username_field_; | 49 views::Textfield* username_field_; |
| 49 views::Textfield* password_field_; | 50 views::Textfield* password_field_; |
| 50 | 51 |
| 51 // Button labels | 52 // Button labels |
| 52 views::Label* username_label_; | 53 views::Label* username_label_; |
| 53 views::Label* password_label_; | 54 views::Label* password_label_; |
| 54 | 55 |
| 55 // Authentication message. | 56 // Authority and security state messages. |
| 57 views::Label* authority_label_; |
| 56 views::Label* message_label_; | 58 views::Label* message_label_; |
| 57 | 59 |
| 58 // If not null, points to a model we need to notify of our own destruction | 60 // If not null, points to a model we need to notify of our own destruction |
| 59 // so it doesn't try and access this when its too late. | 61 // so it doesn't try and access this when its too late. |
| 60 password_manager::LoginModel* login_model_; | 62 password_manager::LoginModel* login_model_; |
| 61 | 63 |
| 62 DISALLOW_COPY_AND_ASSIGN(LoginView); | 64 DISALLOW_COPY_AND_ASSIGN(LoginView); |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 #endif // CHROME_BROWSER_UI_VIEWS_LOGIN_VIEW_H_ | 67 #endif // CHROME_BROWSER_UI_VIEWS_LOGIN_VIEW_H_ |
| OLD | NEW |