Chromium Code Reviews| Index: ash/login/ui/login_password_view.h |
| diff --git a/ash/login/ui/login_password_view.h b/ash/login/ui/login_password_view.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4ec6e6a8286ca2e8971c52b6409c541b04d4d046 |
| --- /dev/null |
| +++ b/ash/login/ui/login_password_view.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ASH_LOGIN_UI_LOGIN_PASSWORD_VIEW_H_ |
| +#define ASH_LOGIN_UI_LOGIN_PASSWORD_VIEW_H_ |
| + |
| +#include "ash/ash_export.h" |
| +#include "base/strings/string16.h" |
| +#include "ui/views/controls/button/button.h" |
| +#include "ui/views/view.h" |
| + |
| +namespace views { |
| +class ButtonListener; |
| +class Textfield; |
| +} |
| + |
| +namespace ash { |
| + |
| +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.
|
| + public views::ButtonListener { |
| + public: |
| + // TestApi is used for tests to get internal implementation details. |
| + class ASH_EXPORT TestApi { |
| + public: |
| + explicit TestApi(LoginPasswordView* view); |
| + ~TestApi(); |
| + |
| + views::View* textfield() const; |
| + views::View* submit_button() const; |
| + |
| + private: |
| + LoginPasswordView* view_; |
| + }; |
| + |
| + 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
|
| + |
| + 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.
|
| + ~LoginPasswordView() override; |
| + |
| + // views::View: |
| + const char* GetClassName() const override; |
| + gfx::Size CalculatePreferredSize() const override; |
| + bool OnKeyPressed(const ui::KeyEvent& event) override; |
| + |
| + // views::ButtonListener: |
| + void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| + |
| + private: |
| + friend class TestApi; |
| + |
| + // Submits the current password field text to mojo call and resets the text |
| + // field. |
| + void SubmitPassword(); |
| + |
| + OnPasswordSubmit on_submit_; |
| + views::Textfield* textfield_; |
| + views::View* submit_button_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(LoginPasswordView); |
| +}; |
| + |
| +} // namespace ash |
| + |
| +#endif // ASH_LOGIN_UI_LOGIN_PASSWORD_VIEW_H_ |