| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_BASE_LOGIN_DISPLAY_HOST_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_BASE_LOGIN_DISPLAY_HOST_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "chrome/browser/chromeos/login/login_display.h" | |
| 14 #include "chrome/browser/chromeos/login/login_display_host.h" | |
| 15 #include "chrome/browser/chromeos/settings/device_settings_service.h" | |
| 16 #include "content/public/browser/notification_observer.h" | |
| 17 #include "content/public/browser/notification_registrar.h" | |
| 18 #include "ui/gfx/rect.h" | |
| 19 | |
| 20 class PrefService; | |
| 21 | |
| 22 namespace policy { | |
| 23 class AutoEnrollmentClient; | |
| 24 } // namespace policy | |
| 25 | |
| 26 namespace chromeos { | |
| 27 | |
| 28 class ExistingUserController; | |
| 29 class WizardController; | |
| 30 | |
| 31 // An abstract base class that defines OOBE/login screen host. | |
| 32 // It encapsulates controllers, background integration and flow. | |
| 33 class BaseLoginDisplayHost : public LoginDisplayHost, | |
| 34 public content::NotificationObserver { | |
| 35 public: | |
| 36 explicit BaseLoginDisplayHost(const gfx::Rect& background_bounds); | |
| 37 virtual ~BaseLoginDisplayHost(); | |
| 38 | |
| 39 // Returns the default LoginDispalyHost instance if it has been created. | |
| 40 static LoginDisplayHost* default_host() { | |
| 41 return default_host_; | |
| 42 } | |
| 43 | |
| 44 // LoginDisplayHost implementation: | |
| 45 virtual void BeforeSessionStart() OVERRIDE; | |
| 46 virtual void OnSessionStart() OVERRIDE; | |
| 47 virtual void OnCompleteLogin() OVERRIDE; | |
| 48 virtual void StartWizard( | |
| 49 const std::string& first_screen_name, | |
| 50 DictionaryValue* screen_parameters) OVERRIDE; | |
| 51 virtual void StartSignInScreen() OVERRIDE; | |
| 52 virtual void ResumeSignInScreen() OVERRIDE; | |
| 53 virtual void CheckForAutoEnrollment() OVERRIDE; | |
| 54 virtual WizardController* GetWizardController() OVERRIDE; | |
| 55 | |
| 56 // Creates specific WizardController. | |
| 57 virtual WizardController* CreateWizardController() = 0; | |
| 58 | |
| 59 // Called when the first browser window is created, but before it's | |
| 60 // ready (shown). | |
| 61 virtual void OnBrowserCreated() = 0; | |
| 62 | |
| 63 const gfx::Rect& background_bounds() const { return background_bounds_; } | |
| 64 | |
| 65 protected: | |
| 66 // content::NotificationObserver implementation: | |
| 67 virtual void Observe(int type, | |
| 68 const content::NotificationSource& source, | |
| 69 const content::NotificationDetails& details) OVERRIDE; | |
| 70 | |
| 71 private: | |
| 72 // Marks display host for deletion. | |
| 73 // If |post_quit_task| is true also posts Quit task to the MessageLoop. | |
| 74 void ShutdownDisplayHost(bool post_quit_task); | |
| 75 | |
| 76 // Start sign in transition animation. | |
| 77 void StartAnimation(); | |
| 78 | |
| 79 // Callback for the ownership status check. | |
| 80 void OnOwnershipStatusCheckDone(DeviceSettingsService::OwnershipStatus status, | |
| 81 bool current_user_is_owner); | |
| 82 | |
| 83 // Callback for completion of the |auto_enrollment_client_|. | |
| 84 void OnAutoEnrollmentClientDone(); | |
| 85 | |
| 86 // Forces auto-enrollment on the appropriate controller. | |
| 87 void ForceAutoEnrollment(); | |
| 88 | |
| 89 // Used to calculate position of the screens and background. | |
| 90 gfx::Rect background_bounds_; | |
| 91 | |
| 92 content::NotificationRegistrar registrar_; | |
| 93 | |
| 94 base::WeakPtrFactory<BaseLoginDisplayHost> pointer_factory_; | |
| 95 | |
| 96 // Default LoginDisplayHost. | |
| 97 static LoginDisplayHost* default_host_; | |
| 98 | |
| 99 // Sign in screen controller. | |
| 100 scoped_ptr<ExistingUserController> sign_in_controller_; | |
| 101 | |
| 102 // OOBE and some screens (camera, recovery) controller. | |
| 103 scoped_ptr<WizardController> wizard_controller_; | |
| 104 | |
| 105 // Client for enterprise auto-enrollment check. | |
| 106 scoped_ptr<policy::AutoEnrollmentClient> auto_enrollment_client_; | |
| 107 | |
| 108 // Has ShutdownDisplayHost() already been called? Used to avoid posting our | |
| 109 // own deletion to the message loop twice if the user logs out while we're | |
| 110 // still in the process of cleaning up after login (http://crbug.com/134463). | |
| 111 bool shutting_down_; | |
| 112 | |
| 113 // Whether progress bar is shown on the OOBE page. | |
| 114 bool oobe_progress_bar_visible_; | |
| 115 | |
| 116 // True if session start is in progress. | |
| 117 bool session_starting_; | |
| 118 | |
| 119 DISALLOW_COPY_AND_ASSIGN(BaseLoginDisplayHost); | |
| 120 }; | |
| 121 | |
| 122 } // namespace chromeos | |
| 123 | |
| 124 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_BASE_LOGIN_DISPLAY_HOST_H_ | |
| OLD | NEW |