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