OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 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_CHROMEOS_PASSWORD_DIALOG_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_PASSWORD_DIALOG_VIEW_H_ |
| 7 |
| 8 #include "base/string16.h" |
| 9 #include "views/window/dialog_delegate.h" |
| 10 |
| 11 namespace views { |
| 12 class Textfield; |
| 13 class View; |
| 14 class Window; |
| 15 } |
| 16 |
| 17 // Delegate implemented by caller of PasswordDialogView to handle the user |
| 18 // interacting with the dialog box. |
| 19 class PasswordDialogDelegate { |
| 20 public: |
| 21 // Called when user clicks on cancel button. |
| 22 // Return whether or not to allow password dialog to close. |
| 23 virtual bool OnPasswordDialogCancel() = 0; |
| 24 |
| 25 // Called when user clicks on ok with a password. |
| 26 // Return whether or not to allow password dialog to close. |
| 27 virtual bool OnPasswordDialogAccept(const string16& password) = 0; |
| 28 }; |
| 29 |
| 30 // A dialog box for showing a password textfield. |
| 31 class PasswordDialogView : public views::View, |
| 32 public views::DialogDelegate { |
| 33 public: |
| 34 explicit PasswordDialogView(PasswordDialogDelegate* delegate); |
| 35 virtual ~PasswordDialogView() {} |
| 36 |
| 37 // views::DialogDelegate methods. |
| 38 virtual bool Cancel(); |
| 39 virtual bool Accept(); |
| 40 virtual std::wstring GetWindowTitle() const; |
| 41 |
| 42 // views::WindowDelegate method. |
| 43 virtual bool IsModal() const { return true; } |
| 44 virtual views::View* GetContentsView() { return this; } |
| 45 |
| 46 // views::View overrides. |
| 47 virtual void Layout(); |
| 48 virtual gfx::Size GetPreferredSize(); |
| 49 |
| 50 protected: |
| 51 virtual void ViewHierarchyChanged(bool is_add, views::View* parent, |
| 52 views::View* child); |
| 53 |
| 54 private: |
| 55 void Init(); |
| 56 |
| 57 // Used for call back to delegate that password has been entered. |
| 58 PasswordDialogDelegate* delegate_; |
| 59 |
| 60 // Combobox and its corresponding model. |
| 61 views::Textfield* password_textfield_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(PasswordDialogView); |
| 64 }; |
| 65 |
| 66 #endif // CHROME_BROWSER_CHROMEOS_PASSWORD_DIALOG_VIEW_H_ |
OLD | NEW |