OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/callback.h" |
| 13 #include "base/gtest_prod_util.h" |
| 14 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
| 15 #include "ui/views/controls/textfield/textfield_controller.h" |
| 16 #include "ui/views/window/dialog_delegate.h" |
| 17 |
| 18 namespace views { |
| 19 class Textfield; |
| 20 class Label; |
| 21 } |
| 22 |
| 23 namespace browser { |
| 24 |
| 25 // CryptoModulePasswordDialogView |
| 26 // Dialog view for crypto module password interaction. |
| 27 ///////////////////////////////////////////////////////////////////////// |
| 28 class CryptoModulePasswordDialogView : public views::DialogDelegateView, |
| 29 public views::TextfieldController { |
| 30 public: |
| 31 CryptoModulePasswordDialogView( |
| 32 const std::string& slot_name, |
| 33 browser::CryptoModulePasswordReason reason, |
| 34 const std::string& server, |
| 35 const base::Callback<void(const char*)>& callback); |
| 36 |
| 37 virtual ~CryptoModulePasswordDialogView() {} |
| 38 |
| 39 // views::DialogDelegate: |
| 40 virtual bool Accept(); |
| 41 virtual bool Cancel(); |
| 42 string16 GetDialogButtonLabel( |
| 43 ui::DialogButton button) const; |
| 44 |
| 45 |
| 46 // views::WidgetDelegate: |
| 47 virtual views::View* GetInitiallyFocusedView(); |
| 48 virtual bool IsModal() const; |
| 49 virtual views::View* GetContentsView(); |
| 50 |
| 51 // views::View: |
| 52 virtual string16 GetWindowTitle() const; |
| 53 |
| 54 // views::TextfieldController: |
| 55 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 56 const views::KeyEvent& keystroke); |
| 57 virtual void ContentsChanged(views::Textfield* sender, |
| 58 const string16& new_contents) {} |
| 59 |
| 60 private: |
| 61 // Initialize views and layout. |
| 62 void Init(const std::string& server, |
| 63 const std::string& slot_name, |
| 64 browser::CryptoModulePasswordReason reason); |
| 65 |
| 66 views::Label* title_label_; |
| 67 views::Label* reason_label_; |
| 68 views::Label* password_label_; |
| 69 views::Textfield* password_entry_; |
| 70 |
| 71 const base::Callback<void(const char*)> callback_; |
| 72 FRIEND_TEST_ALL_PREFIXES(CryptoModulePasswordDialogViewTest, TestAccept); |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(CryptoModulePasswordDialogView); |
| 75 }; |
| 76 |
| 77 } // namespace browser |
| 78 |
| 79 #endif // CHROME_BROWSER_UI_VIEWS_CRYPTO_MODULE_PASSWORD_DIALOG_VIEW_H_ |
OLD | NEW |