1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_PROFILE_LOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_PROFILE_LOADER_H_
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
14 #include "chrome/browser/chromeos/login/auth/login_performer.h"
15 #include "chrome/browser/chromeos/login/login_utils.h"
21 // KioskProfileLoader loads a special profile for a given app. It first
22 // attempts to login for the app's generated user id. If the login is
23 // successful, it prepares app profile then calls the delegate.
24 class KioskProfileLoader : public LoginPerformer::Delegate,
25 public LoginUtils::Delegate {
29 virtual void OnProfileLoaded(Profile* profile) = 0;
30 virtual void OnProfileLoadFailed(KioskAppLaunchError::Error error) = 0;
33 virtual ~Delegate() {}
36 KioskProfileLoader(const std::string& app_user_id,
40 virtual ~KioskProfileLoader();
42 // Starts profile load. Calls delegate on success or failure.
46 class CryptohomedChecker;
48 void LoginAsKioskAccount();
49 void ReportLaunchResult(KioskAppLaunchError::Error error);
51 // LoginPerformer::Delegate overrides
52 virtual void OnAuthSuccess(const UserContext& user_context) OVERRIDE;
53 virtual void OnAuthFailure(const AuthFailure& error) OVERRIDE;
54 virtual void WhiteListCheckFailed(const std::string& email) OVERRIDE;
55 virtual void PolicyLoadFailed() OVERRIDE;
56 virtual void OnOnlineChecked(
57 const std::string& email, bool success) OVERRIDE;
59 // LoginUtils::Delegate implementation:
60 virtual void OnProfilePrepared(Profile* profile) OVERRIDE;
63 bool use_guest_mount_;
65 scoped_ptr<CryptohomedChecker> cryptohomed_checker_;
66 scoped_ptr<LoginPerformer> login_performer_;
68 DISALLOW_COPY_AND_ASSIGN(KioskProfileLoader);
71 } // namespace chromeos
73 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_PROFILE_LOADER_H_