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