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_
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"
23 class CryptoModulePasswordDialogView
: public views::DialogDelegateView
,
24 public views::TextfieldController
{
26 CryptoModulePasswordDialogView(const std::string
& slot_name
,
27 CryptoModulePasswordReason reason
,
28 const std::string
& server
,
29 const CryptoModulePasswordCallback
& callback
);
31 virtual ~CryptoModulePasswordDialogView();
34 FRIEND_TEST_ALL_PREFIXES(CryptoModulePasswordDialogViewTest
, TestAccept
);
36 // views::WidgetDelegate:
37 virtual views::View
* GetInitiallyFocusedView() OVERRIDE
;
38 virtual ui::ModalType
GetModalType() const OVERRIDE
;
39 virtual string16
GetWindowTitle() const OVERRIDE
;
41 // views::DialogDelegate:
42 virtual string16
GetDialogButtonLabel(
43 ui::DialogButton button
) const OVERRIDE
;
44 virtual bool Cancel() OVERRIDE
;
45 virtual bool Accept() OVERRIDE
;
47 // views::TextfieldController:
48 virtual void ContentsChanged(views::Textfield
* sender
,
49 const string16
& new_contents
) OVERRIDE
;
50 virtual bool HandleKeyEvent(views::Textfield
* sender
,
51 const ui::KeyEvent
& keystroke
) OVERRIDE
;
53 // Initialize views and layout.
54 void Init(const std::string
& server
,
55 const std::string
& slot_name
,
56 CryptoModulePasswordReason reason
);
58 views::Label
* title_label_
;
59 views::Label
* reason_label_
;
60 views::Label
* password_label_
;
61 views::Textfield
* password_entry_
;
63 const CryptoModulePasswordCallback callback_
;
65 DISALLOW_COPY_AND_ASSIGN(CryptoModulePasswordDialogView
);
70 #endif // CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_