OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXISTING_USER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
12 #include "base/task.h" | 12 #include "base/task.h" |
13 #include "base/timer.h" | 13 #include "base/timer.h" |
| 14 #include "chrome/browser/chromeos/login/captcha_view.h" |
14 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 15 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
15 #include "chrome/browser/chromeos/login/user_manager.h" | 16 #include "chrome/browser/chromeos/login/user_manager.h" |
16 #include "chrome/browser/chromeos/login/user_controller.h" | 17 #include "chrome/browser/chromeos/login/user_controller.h" |
17 #include "chrome/browser/chromeos/wm_message_listener.h" | 18 #include "chrome/browser/chromeos/wm_message_listener.h" |
18 #include "chrome/browser/views/info_bubble.h" | 19 #include "chrome/browser/views/info_bubble.h" |
19 #include "gfx/size.h" | 20 #include "gfx/size.h" |
20 | 21 |
21 namespace views { | 22 namespace views { |
22 class Wiget; | 23 class Wiget; |
23 } | 24 } |
(...skipping 10 matching lines...) Expand all Loading... |
34 // window manager is then told to show the windows. If the user clicks on the | 35 // window manager is then told to show the windows. If the user clicks on the |
35 // guest entry the WizardWindow is swapped in. | 36 // guest entry the WizardWindow is swapped in. |
36 // | 37 // |
37 // To use ExistingUserController create an instance of it and invoke Init. | 38 // To use ExistingUserController create an instance of it and invoke Init. |
38 // | 39 // |
39 // ExistingUserController maintains it's own life cycle and deletes itself when | 40 // ExistingUserController maintains it's own life cycle and deletes itself when |
40 // the user logs in (or chooses to see other settings). | 41 // the user logs in (or chooses to see other settings). |
41 class ExistingUserController : public WmMessageListener::Observer, | 42 class ExistingUserController : public WmMessageListener::Observer, |
42 public UserController::Delegate, | 43 public UserController::Delegate, |
43 public LoginStatusConsumer, | 44 public LoginStatusConsumer, |
44 public InfoBubbleDelegate { | 45 public InfoBubbleDelegate, |
| 46 public CaptchaView::Delegate { |
45 public: | 47 public: |
46 // Initializes views for known users. |background_bounds| determines the | 48 // Initializes views for known users. |background_bounds| determines the |
47 // bounds of background view. | 49 // bounds of background view. |
48 ExistingUserController(const std::vector<UserManager::User>& users, | 50 ExistingUserController(const std::vector<UserManager::User>& users, |
49 const gfx::Rect& background_bounds); | 51 const gfx::Rect& background_bounds); |
50 | 52 |
51 // Creates and shows the appropriate set of windows. | 53 // Creates and shows the appropriate set of windows. |
52 void Init(); | 54 void Init(); |
53 | 55 |
54 private: | 56 private: |
(...skipping 22 matching lines...) Expand all Loading... |
77 virtual void OnOffTheRecordLoginSuccess(); | 79 virtual void OnOffTheRecordLoginSuccess(); |
78 | 80 |
79 // Overridden from views::InfoBubbleDelegate. | 81 // Overridden from views::InfoBubbleDelegate. |
80 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | 82 virtual void InfoBubbleClosing(InfoBubble* info_bubble, |
81 bool closed_by_escape) { | 83 bool closed_by_escape) { |
82 bubble_ = NULL; | 84 bubble_ = NULL; |
83 } | 85 } |
84 virtual bool CloseOnEscape() { return true; } | 86 virtual bool CloseOnEscape() { return true; } |
85 virtual bool FadeInOnShow() { return false; } | 87 virtual bool FadeInOnShow() { return false; } |
86 | 88 |
| 89 // CaptchaView::Delegate: |
| 90 virtual void OnCaptchaEntered(const std::string& captcha); |
| 91 |
| 92 // Clears existing captcha state; |
| 93 void ClearCaptchaState(); |
| 94 |
87 // Show error message. |error_id| error message ID in resources. | 95 // Show error message. |error_id| error message ID in resources. |
88 // If |details| string is not empty, it specify additional error text | 96 // If |details| string is not empty, it specify additional error text |
89 // provided by authenticator, it is not localized. | 97 // provided by authenticator, it is not localized. |
90 void ShowError(int error_id, const std::string& details); | 98 void ShowError(int error_id, const std::string& details); |
91 | 99 |
92 // Send message to window manager to enable/disable click on other windows. | 100 // Send message to window manager to enable/disable click on other windows. |
93 void SendSetLoginState(bool is_login); | 101 void SendSetLoginState(bool is_login); |
94 | 102 |
95 // Bounds of the background window. | 103 // Bounds of the background window. |
96 const gfx::Rect background_bounds_; | 104 const gfx::Rect background_bounds_; |
(...skipping 11 matching lines...) Expand all Loading... |
108 // Index of selected view (user). | 116 // Index of selected view (user). |
109 size_t selected_view_index_; | 117 size_t selected_view_index_; |
110 | 118 |
111 // See comment in ProcessWmMessage. | 119 // See comment in ProcessWmMessage. |
112 base::OneShotTimer<ExistingUserController> delete_timer_; | 120 base::OneShotTimer<ExistingUserController> delete_timer_; |
113 | 121 |
114 // Pointer to shown message bubble. We don't need to delete it because | 122 // Pointer to shown message bubble. We don't need to delete it because |
115 // it will be deleted on bubble closing. | 123 // it will be deleted on bubble closing. |
116 MessageBubble* bubble_; | 124 MessageBubble* bubble_; |
117 | 125 |
| 126 // Token representing the specific CAPTCHA challenge. |
| 127 std::string login_token_; |
| 128 |
| 129 // String entered by the user as an answer to a CAPTCHA challenge. |
| 130 std::string login_captcha_; |
| 131 |
118 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); | 132 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); |
119 }; | 133 }; |
120 | 134 |
121 } // namespace chromeos | 135 } // namespace chromeos |
122 | 136 |
123 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 137 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
OLD | NEW |