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_LOGIN_DISPLAY_HOST_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_DISPLAY_HOST_H_ 7 8 #include <string> 9 10 #include "base/callback.h" 11 #include "base/memory/scoped_ptr.h" 12 #include "base/values.h" 13 #include "chrome/browser/chromeos/customization_document.h" 14 #include "chrome/browser/chromeos/login/login_display.h" 15 #include "ui/gfx/native_widget_types.h" 16 17 namespace views { 18 class Widget; 19 } // namespace views 20 21 namespace chromeos { 22 23 class AppLaunchController; 24 class LoginScreenContext; 25 class WebUILoginView; 26 class WizardController; 27 28 // An interface that defines OOBE/login screen host. 29 // Host encapsulates WebUI window OOBE/login controllers, 30 // UI implementation (such as LoginDisplay). 31 class LoginDisplayHost { 32 public: 33 // Callback for GetAutoEnrollmentCheckResult. It is invoked with when 34 // a decision is made for auto enrollment. It is invoked with "true" when 35 // auto enrollment check is finished and auto enrollment should be enforced. 36 // Otherwise, it is invoked with "false". 37 typedef base::Callback<void(bool)> GetAutoEnrollmentCheckResultCallback; 38 39 virtual ~LoginDisplayHost() {} 40 41 // Creates UI implementation specific login display instance (views/WebUI). 42 // The caller takes ownership of the returned value. 43 virtual LoginDisplay* CreateLoginDisplay( 44 LoginDisplay::Delegate* delegate) = 0; 45 46 // Returns corresponding native window. 47 virtual gfx::NativeWindow GetNativeWindow() const = 0; 48 49 // Returns the current login view. 50 virtual WebUILoginView* GetWebUILoginView() const = 0; 51 52 // Called when browsing session starts before creating initial browser. 53 virtual void BeforeSessionStart() = 0; 54 55 // Called when user enters or returns to browsing session so 56 // LoginDisplayHost instance may delete itself. 57 virtual void Finalize() = 0; 58 59 // Called when a login has completed successfully. 60 virtual void OnCompleteLogin() = 0; 61 62 // Open proxy settings dialog. 63 virtual void OpenProxySettings() = 0; 64 65 // Toggles status area visibility. 66 virtual void SetStatusAreaVisible(bool visible) = 0; 67 68 // Signals the LoginDisplayHost that it can proceed with the Enterprise 69 // Auto-Enrollment checks now. 70 virtual void CheckForAutoEnrollment() = 0; 71 72 // Gets the auto enrollment check results. If the check is still pending, 73 // |callback| will be invoked asynchronously after it is finished. Otherwise, 74 // |callback| is invoked synchronously before this call returns. 75 virtual void GetAutoEnrollmentCheckResult( 76 const GetAutoEnrollmentCheckResultCallback& callback) = 0; 77 78 // Starts out-of-box-experience flow or shows other screen handled by 79 // Wizard controller i.e. camera, recovery. 80 // One could specify start screen with |first_screen_name|. 81 // Takes ownership of |screen_parameters|, which can also be NULL. 82 virtual void StartWizard( 83 const std::string& first_screen_name, 84 scoped_ptr<DictionaryValue> screen_parameters) = 0; 85 86 // Returns current WizardController, if it exists. 87 // Result should not be stored. 88 virtual WizardController* GetWizardController() = 0; 89 90 // Returns current AppLaunchController, if it exists. 91 // Result should not be stored. 92 virtual AppLaunchController* GetAppLaunchController() = 0; 93 94 // Starts screen for adding user into session. 95 // |completion_callback| called before display host shutdown. 96 // |completion_callback| can be null. 97 virtual void StartUserAdding(const base::Closure& completion_callback) = 0; 98 99 // Starts sign in screen. 100 virtual void StartSignInScreen(const LoginScreenContext& context) = 0; 101 102 // Resumes a previously started sign in screen. 103 virtual void ResumeSignInScreen() = 0; 104 105 // Invoked when system preferences that affect the signin screen have changed. 106 virtual void OnPreferencesChanged() = 0; 107 108 // Initiates authentication network prewarming. 109 virtual void PrewarmAuthentication() = 0; 110 111 // Starts app launch splash screen. 112 virtual void StartAppLaunch(const std::string& app_id) = 0; 113 }; 114 115 } // namespace chromeos 116 117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_DISPLAY_HOST_H_ 118