OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/timer.h" | 17 #include "base/timer.h" |
18 #include "chrome/browser/chromeos/login/login_display.h" | 18 #include "chrome/browser/chromeos/login/login_display.h" |
19 #include "chrome/browser/chromeos/login/login_performer.h" | 19 #include "chrome/browser/chromeos/login/login_performer.h" |
20 #include "chrome/browser/chromeos/login/login_utils.h" | 20 #include "chrome/browser/chromeos/login/login_utils.h" |
21 #include "chrome/browser/chromeos/login/user.h" | 21 #include "chrome/browser/chromeos/login/user.h" |
22 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 22 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 23 #include "chrome/browser/policy/policy_change_watcher.h" |
23 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
24 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
25 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
26 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
27 | 28 |
28 namespace chromeos { | 29 namespace chromeos { |
29 | 30 |
30 class CrosSettings; | 31 class CrosSettings; |
31 class LoginDisplayHost; | 32 class LoginDisplayHost; |
32 | 33 |
33 // ExistingUserController is used to handle login when someone has | 34 // ExistingUserController is used to handle login when someone has |
34 // already logged into the machine. | 35 // already logged into the machine. |
35 // To use ExistingUserController create an instance of it and invoke Init. | 36 // To use ExistingUserController create an instance of it and invoke Init. |
36 // When Init is called it creates LoginDisplay instance which encapsulates | 37 // When Init is called it creates LoginDisplay instance which encapsulates |
37 // all login UI implementation. | 38 // all login UI implementation. |
38 // ExistingUserController maintains it's own life cycle and deletes itself when | 39 // ExistingUserController maintains it's own life cycle and deletes itself when |
39 // the user logs in (or chooses to see other settings). | 40 // the user logs in (or chooses to see other settings). |
40 class ExistingUserController : public LoginDisplay::Delegate, | 41 class ExistingUserController |
41 public content::NotificationObserver, | 42 : public LoginDisplay::Delegate, |
42 public LoginPerformer::Delegate, | 43 public content::NotificationObserver, |
43 public LoginUtils::Delegate { | 44 public LoginPerformer::Delegate, |
| 45 public LoginUtils::Delegate, |
| 46 public policy::DevicePolicyChangeWatcher::Observer { |
44 public: | 47 public: |
45 // All UI initialization is deferred till Init() call. | 48 // All UI initialization is deferred till Init() call. |
46 explicit ExistingUserController(LoginDisplayHost* host); | 49 explicit ExistingUserController(LoginDisplayHost* host); |
47 virtual ~ExistingUserController(); | 50 virtual ~ExistingUserController(); |
48 | 51 |
49 // Returns the current existing user controller if it has been created. | 52 // Returns the current existing user controller if it has been created. |
50 static ExistingUserController* current_controller() { | 53 static ExistingUserController* current_controller() { |
51 return current_controller_; | 54 return current_controller_; |
52 } | 55 } |
53 | 56 |
(...skipping 27 matching lines...) Expand all Loading... |
81 virtual void ResyncUserData() OVERRIDE; | 84 virtual void ResyncUserData() OVERRIDE; |
82 virtual void SetDisplayEmail(const std::string& email) OVERRIDE; | 85 virtual void SetDisplayEmail(const std::string& email) OVERRIDE; |
83 virtual void ShowWrongHWIDScreen() OVERRIDE; | 86 virtual void ShowWrongHWIDScreen() OVERRIDE; |
84 virtual void Signout() OVERRIDE; | 87 virtual void Signout() OVERRIDE; |
85 | 88 |
86 // content::NotificationObserver implementation. | 89 // content::NotificationObserver implementation. |
87 virtual void Observe(int type, | 90 virtual void Observe(int type, |
88 const content::NotificationSource& source, | 91 const content::NotificationSource& source, |
89 const content::NotificationDetails& details) OVERRIDE; | 92 const content::NotificationDetails& details) OVERRIDE; |
90 | 93 |
| 94 // DevicePolicyChangeWatcher::Observer implementation. |
| 95 virtual void OnDevicePolicyStatusChanged( |
| 96 const std::vector<std::string>& |
| 97 users_with_changed_device_policy) OVERRIDE; |
| 98 |
91 // Set a delegate that we will pass LoginStatusConsumer events to. | 99 // Set a delegate that we will pass LoginStatusConsumer events to. |
92 // Used for testing. | 100 // Used for testing. |
93 void set_login_status_consumer(LoginStatusConsumer* consumer) { | 101 void set_login_status_consumer(LoginStatusConsumer* consumer) { |
94 login_status_consumer_ = consumer; | 102 login_status_consumer_ = consumer; |
95 } | 103 } |
96 | 104 |
97 // Returns the LoginDisplay created and owned by this controller. | 105 // Returns the LoginDisplay created and owned by this controller. |
98 // Used for testing. | 106 // Used for testing. |
99 LoginDisplay* login_display() { | 107 LoginDisplay* login_display() { |
100 return login_display_.get(); | 108 return login_display_.get(); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 base::OneShotTimer<ExistingUserController> reboot_timer_; | 271 base::OneShotTimer<ExistingUserController> reboot_timer_; |
264 | 272 |
265 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin); | 273 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin); |
266 | 274 |
267 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); | 275 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); |
268 }; | 276 }; |
269 | 277 |
270 } // namespace chromeos | 278 } // namespace chromeos |
271 | 279 |
272 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 280 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
OLD | NEW |