OLD | NEW |
1 // Copyright (c) 2011 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_BASE_LOGIN_DISPLAY_HOST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_BASE_LOGIN_DISPLAY_HOST_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_BASE_LOGIN_DISPLAY_HOST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_BASE_LOGIN_DISPLAY_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/chromeos/login/login_display.h" | 12 #include "chrome/browser/chromeos/login/login_display.h" |
13 #include "chrome/browser/chromeos/login/login_display_host.h" | 13 #include "chrome/browser/chromeos/login/login_display_host.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 class Widget; | 19 class Widget; |
20 } | 20 } |
21 | 21 |
22 namespace chromeos { | 22 namespace chromeos { |
23 | 23 |
24 class ExistingUserController; | 24 class ExistingUserController; |
25 class ViewsOobeDisplay; | |
26 class WizardController; | 25 class WizardController; |
27 | 26 |
28 // An abstract base class that defines OOBE/login screen host. | 27 // An abstract base class that defines OOBE/login screen host. |
29 // It encapsulates controllers, background integration and flow. | 28 // It encapsulates controllers, background integration and flow. |
30 class BaseLoginDisplayHost : public LoginDisplayHost, | 29 class BaseLoginDisplayHost : public LoginDisplayHost, |
31 public content::NotificationObserver { | 30 public content::NotificationObserver { |
32 public: | 31 public: |
33 explicit BaseLoginDisplayHost(const gfx::Rect& background_bounds); | 32 explicit BaseLoginDisplayHost(const gfx::Rect& background_bounds); |
34 virtual ~BaseLoginDisplayHost(); | 33 virtual ~BaseLoginDisplayHost(); |
35 | 34 |
36 // Returns the default LoginDispalyHost instance if it has been created. | 35 // Returns the default LoginDispalyHost instance if it has been created. |
37 static LoginDisplayHost* default_host() { | 36 static LoginDisplayHost* default_host() { |
38 return default_host_; | 37 return default_host_; |
39 } | 38 } |
40 | 39 |
41 // LoginDisplayHost implementation: | 40 // LoginDisplayHost implementation: |
42 virtual void OnSessionStart(); | 41 virtual void OnSessionStart(); |
43 virtual void StartWizard( | 42 virtual void StartWizard( |
44 const std::string& first_screen_name, | 43 const std::string& first_screen_name, |
45 const GURL& start_url); | 44 const GURL& start_url); |
46 virtual void StartSignInScreen(); | 45 virtual void StartSignInScreen(); |
47 | 46 |
48 // Implementation specific WizardController creation method. | 47 // Creates specific WizardController. |
49 virtual WizardController* CreateWizardController(); | 48 virtual WizardController* CreateWizardController() = 0; |
50 | 49 |
51 const gfx::Rect& background_bounds() const { return background_bounds_; } | 50 const gfx::Rect& background_bounds() const { return background_bounds_; } |
52 | 51 |
53 private: | 52 private: |
54 // content::NotificationObserver implementation: | 53 // content::NotificationObserver implementation: |
55 virtual void Observe(int type, | 54 virtual void Observe(int type, |
56 const content::NotificationSource& source, | 55 const content::NotificationSource& source, |
57 const content::NotificationDetails& details); | 56 const content::NotificationDetails& details); |
58 | 57 |
59 // Used to calculate position of the screens and background. | 58 // Used to calculate position of the screens and background. |
60 gfx::Rect background_bounds_; | 59 gfx::Rect background_bounds_; |
61 | 60 |
62 content::NotificationRegistrar registrar_; | 61 content::NotificationRegistrar registrar_; |
63 | 62 |
64 // Default LoginDisplayHost. | 63 // Default LoginDisplayHost. |
65 static LoginDisplayHost* default_host_; | 64 static LoginDisplayHost* default_host_; |
66 | 65 |
67 // Sign in screen controller. | 66 // Sign in screen controller. |
68 scoped_ptr<ExistingUserController> sign_in_controller_; | 67 scoped_ptr<ExistingUserController> sign_in_controller_; |
69 | 68 |
70 // OOBE and some screens (camera, recovery) controller. | 69 // OOBE and some screens (camera, recovery) controller. |
71 scoped_ptr<WizardController> wizard_controller_; | 70 scoped_ptr<WizardController> wizard_controller_; |
72 | 71 |
73 // Keeps views based OobeDisplay implementation if any. | |
74 // TODO(altimofeev): move it to ViewsLoginDisplayHost. Also see comment in | |
75 // the CreateWizardController(). | |
76 scoped_ptr<ViewsOobeDisplay> oobe_display_; | |
77 | |
78 DISALLOW_COPY_AND_ASSIGN(BaseLoginDisplayHost); | 72 DISALLOW_COPY_AND_ASSIGN(BaseLoginDisplayHost); |
79 }; | 73 }; |
80 | 74 |
81 } // namespace chromeos | 75 } // namespace chromeos |
82 | 76 |
83 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_BASE_LOGIN_DISPLAY_HOST_H_ | 77 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_BASE_LOGIN_DISPLAY_HOST_H_ |
OLD | NEW |