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