OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_LOGIN_UI_LOGIN_PASSWORD_VIEW_H_ | |
6 #define ASH_LOGIN_UI_LOGIN_PASSWORD_VIEW_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "base/strings/string16.h" | |
10 #include "ui/views/controls/button/button.h" | |
11 #include "ui/views/view.h" | |
12 | |
13 namespace views { | |
14 class ButtonListener; | |
15 class Textfield; | |
16 } | |
17 | |
18 namespace ash { | |
19 | |
20 class ASH_EXPORT LoginPasswordView : public views::View, | |
James Cook
2017/06/08 17:26:31
class documentation please.
optional: Little asci
jdufault
2017/06/08 23:12:33
Done.
| |
21 public views::ButtonListener { | |
22 public: | |
23 // TestApi is used for tests to get internal implementation details. | |
24 class ASH_EXPORT TestApi { | |
25 public: | |
26 explicit TestApi(LoginPasswordView* view); | |
27 ~TestApi(); | |
28 | |
29 views::View* textfield() const; | |
30 views::View* submit_button() const; | |
31 | |
32 private: | |
33 LoginPasswordView* view_; | |
34 }; | |
35 | |
36 using OnPasswordSubmit = base::Callback<void(const base::string16& password)>; | |
James Cook
2017/06/08 17:26:31
Can this be OnceCallback?
jdufault
2017/06/08 23:12:33
Changed to RepeatingCallback. It is expected this
| |
37 | |
38 explicit LoginPasswordView(const OnPasswordSubmit& on_submit); | |
James Cook
2017/06/08 17:26:31
Document if on_submit is allowed to be null. If no
jdufault
2017/06/08 23:12:33
Done.
| |
39 ~LoginPasswordView() override; | |
40 | |
41 // views::View: | |
42 const char* GetClassName() const override; | |
43 gfx::Size CalculatePreferredSize() const override; | |
44 bool OnKeyPressed(const ui::KeyEvent& event) override; | |
45 | |
46 // views::ButtonListener: | |
47 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
48 | |
49 private: | |
50 friend class TestApi; | |
51 | |
52 // Submits the current password field text to mojo call and resets the text | |
53 // field. | |
54 void SubmitPassword(); | |
55 | |
56 OnPasswordSubmit on_submit_; | |
57 views::Textfield* textfield_; | |
58 views::View* submit_button_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(LoginPasswordView); | |
61 }; | |
62 | |
63 } // namespace ash | |
64 | |
65 #endif // ASH_LOGIN_UI_LOGIN_PASSWORD_VIEW_H_ | |
OLD | NEW |