Infobar material design refresh: layout
[chromium-blink-merge.git] / chrome / browser / ui / views / crypto_module_password_dialog_view.h
blobeb243fb16a57c3b90e98bd9f7cf7abc2b34a7a9c
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/gtest_prod_util.h"
12 #include "chrome/browser/ui/crypto_module_password_dialog.h"
13 #include "ui/views/controls/textfield/textfield_controller.h"
14 #include "ui/views/window/dialog_delegate.h"
16 namespace views {
17 class Label;
18 class Textfield;
21 namespace chrome {
23 class CryptoModulePasswordDialogView : public views::DialogDelegateView,
24 public views::TextfieldController {
25 public:
26 CryptoModulePasswordDialogView(const std::string& slot_name,
27 CryptoModulePasswordReason reason,
28 const std::string& server,
29 const CryptoModulePasswordCallback& callback);
31 ~CryptoModulePasswordDialogView() override;
33 private:
34 FRIEND_TEST_ALL_PREFIXES(CryptoModulePasswordDialogViewTest, TestAccept);
36 // views::WidgetDelegate:
37 views::View* GetInitiallyFocusedView() override;
38 ui::ModalType GetModalType() const override;
39 base::string16 GetWindowTitle() const override;
41 // views::DialogDelegate:
42 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
43 bool Cancel() override;
44 bool Accept() override;
46 // views::TextfieldController:
47 void ContentsChanged(views::Textfield* sender,
48 const base::string16& new_contents) override;
49 bool HandleKeyEvent(views::Textfield* sender,
50 const ui::KeyEvent& keystroke) override;
52 // Initialize views and layout.
53 void Init(const std::string& server,
54 const std::string& slot_name,
55 CryptoModulePasswordReason reason);
57 views::Label* reason_label_;
58 views::Label* password_label_;
59 views::Textfield* password_entry_;
61 const CryptoModulePasswordCallback callback_;
63 DISALLOW_COPY_AND_ASSIGN(CryptoModulePasswordDialogView);
66 } // namespace chrome
68 #endif // CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_