OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_PASSWORD_CHANGED_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_PASSWORD_CHANGED_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_PASSWORD_CHANGED_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_PASSWORD_CHANGED_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "views/controls/button/button.h" | 11 #include "views/controls/button/button.h" |
12 #include "views/controls/textfield/textfield.h" | 12 #include "views/controls/textfield/textfield_controller.h" |
13 #include "views/view.h" | 13 #include "views/view.h" |
14 #include "views/window/dialog_delegate.h" | 14 #include "views/window/dialog_delegate.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 class Button; | 17 class Button; |
18 class Label; | 18 class Label; |
19 class RadioButton; | 19 class RadioButton; |
20 class Textfield; | 20 class Textfield; |
21 } // namespace views | 21 } // namespace views |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
24 | 24 |
25 // A dialog box that is shown when password change was detected. | 25 // A dialog box that is shown when password change was detected. |
26 // User is presented with an option to sync all settings or | 26 // User is presented with an option to sync all settings or |
27 // enter old password and sync only delta. | 27 // enter old password and sync only delta. |
28 class PasswordChangedView : public views::View, | 28 class PasswordChangedView : public views::View, |
29 public views::DialogDelegate, | 29 public views::DialogDelegate, |
30 public views::ButtonListener, | 30 public views::ButtonListener, |
31 public views::Textfield::Controller { | 31 public views::TextfieldController { |
32 public: | 32 public: |
33 // Delegate class to get notifications from the view. | 33 // Delegate class to get notifications from the view. |
34 class Delegate { | 34 class Delegate { |
35 public: | 35 public: |
36 virtual ~Delegate() {} | 36 virtual ~Delegate() {} |
37 | 37 |
38 // User provided |old_password|, decrypt homedir and sync only delta. | 38 // User provided |old_password|, decrypt homedir and sync only delta. |
39 virtual void RecoverEncryptedData(const std::string& old_password) = 0; | 39 virtual void RecoverEncryptedData(const std::string& old_password) = 0; |
40 | 40 |
41 // Ignores password change and forces full sync. | 41 // Ignores password change and forces full sync. |
42 virtual void ResyncEncryptedData() = 0; | 42 virtual void ResyncEncryptedData() = 0; |
43 }; | 43 }; |
44 | 44 |
45 PasswordChangedView(Delegate* delegate, bool full_sync_disabled); | 45 PasswordChangedView(Delegate* delegate, bool full_sync_disabled); |
46 virtual ~PasswordChangedView() {} | 46 virtual ~PasswordChangedView() {} |
47 | 47 |
48 // views::DialogDelegate overrides: | 48 // views::DialogDelegate: |
49 virtual bool Accept(); | 49 virtual bool Accept(); |
50 virtual int GetDialogButtons() const; | 50 virtual int GetDialogButtons() const; |
51 | 51 |
52 // views::WindowDelegate overrides: | 52 // views::WindowDelegate: |
53 virtual View* GetInitiallyFocusedView(); | 53 virtual View* GetInitiallyFocusedView(); |
54 virtual bool IsModal() const { return true; } | 54 virtual bool IsModal() const { return true; } |
55 virtual views::View* GetContentsView() { return this; } | 55 virtual views::View* GetContentsView() { return this; } |
56 | 56 |
57 // views::View overrides: | 57 // views::View: |
58 virtual std::wstring GetWindowTitle() const; | 58 virtual std::wstring GetWindowTitle() const; |
59 | 59 |
60 // views::ButtonListener overrides: | 60 // views::ButtonListener: |
61 virtual void ButtonPressed(views::Button* sender, | 61 virtual void ButtonPressed(views::Button* sender, |
62 const views::Event& event); | 62 const views::Event& event); |
63 | 63 |
64 // views::Textfield::Controller overrides: | 64 // views::TextfieldController: |
65 virtual bool HandleKeyEvent(views::Textfield* sender, | 65 virtual bool HandleKeyEvent(views::Textfield* sender, |
66 const views::KeyEvent& keystroke) { | 66 const views::KeyEvent& keystroke) { |
67 return false; | 67 return false; |
68 } | 68 } |
69 virtual void ContentsChanged(views::Textfield* sender, | 69 virtual void ContentsChanged(views::Textfield* sender, |
70 const string16& new_contents) {} | 70 const string16& new_contents) {} |
71 | 71 |
72 protected: | 72 protected: |
73 // views::View overrides: | 73 // views::View: |
74 virtual gfx::Size GetPreferredSize(); | 74 virtual gfx::Size GetPreferredSize(); |
75 virtual void ViewHierarchyChanged(bool is_add, | 75 virtual void ViewHierarchyChanged(bool is_add, |
76 views::View* parent, | 76 views::View* parent, |
77 views::View* child); | 77 views::View* child); |
78 | 78 |
79 private: | 79 private: |
80 // Called when dialog is accepted. | 80 // Called when dialog is accepted. |
81 bool ExitDialog(); | 81 bool ExitDialog(); |
82 | 82 |
83 // Initialize view layout. | 83 // Initialize view layout. |
(...skipping 11 matching lines...) Expand all Loading... |
95 | 95 |
96 // Whether full sync option is disabled. | 96 // Whether full sync option is disabled. |
97 bool full_sync_disabled_; | 97 bool full_sync_disabled_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(PasswordChangedView); | 99 DISALLOW_COPY_AND_ASSIGN(PasswordChangedView); |
100 }; | 100 }; |
101 | 101 |
102 } // namespace chromeos | 102 } // namespace chromeos |
103 | 103 |
104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PASSWORD_CHANGED_VIEW_H_ | 104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PASSWORD_CHANGED_VIEW_H_ |
OLD | NEW |