Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_profile_loader.h

Issue 22914008: Refactor kiosk app launch to be part of login screen UI flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_APP_MODE_KIOSK_APP_LAUNCHER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_PROFILE_LOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCHER_H_ 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_PROFILE_LOADER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" 13 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
14 #include "third_party/cros_system_api/dbus/service_constants.h" 14 #include "third_party/cros_system_api/dbus/service_constants.h"
15 15
16 class Profile; 16 class Profile;
17 17
18 namespace chromeos { 18 namespace chromeos {
19 19
20 class KioskAppManager; 20 class KioskAppManager;
21 21
22 // KioskAppLauncher launches a given app from login screen. It first attempts 22 // KioskProfileLoader loads a special profile for a given app. It first attempts
23 // to mount a cryptohome for the app. If the mount is successful, it prepares 23 // to mount a cryptohome for the app. If the mount is successful, it prepares
24 // app profile then calls StartupAppLauncher to finish the launch. If mount 24 // app profile then calls the delegate.
25 // fails, it sets relevant launch error and restart chrome to gets back to 25 class KioskProfileLoader {
26 // the login screen. Note that there should only be one launch attempt in
27 // progress.
28 class KioskAppLauncher {
29 public: 26 public:
30 KioskAppLauncher(KioskAppManager* kiosk_app_manager, 27 class Delegate {
31 const std::string& app_id); 28 public:
29 virtual void OnProfileLoaded(Profile* profile) = 0;
30 virtual void OnProfileLoadFailed(KioskAppLaunchError::Error error) = 0;
31 };
xiyuan 2013/08/15 18:19:42 nit: add a dtor protected: virtual ~Delegate()
Tim Song 2013/08/16 19:07:59 Done.
32 32
33 // Starts a launch attempt. Fails immediately if there is already a launch 33 KioskProfileLoader(KioskAppManager* kiosk_app_manager,
34 // attempt running. 34 const std::string& app_id,
35 Delegate* delegate);
36
37 // Starts profile load. Calls delegate on success or failure.
35 void Start(); 38 void Start();
36 39
37 private: 40 private:
38 class CryptohomedChecker; 41 class CryptohomedChecker;
39 class ProfileLoader; 42 class ProfileLoader;
40 43
41 // Private dtor because this class manages its own lifetime. 44 // Private dtor because this class manages its own lifetime.
42 ~KioskAppLauncher(); 45 ~KioskProfileLoader();
43 46
44 void ReportLaunchResult(KioskAppLaunchError::Error error); 47 void ReportLaunchResult(KioskAppLaunchError::Error error);
45 48
46 void StartMount(); 49 void StartMount();
47 void MountCallback(bool mount_success, cryptohome::MountError mount_error); 50 void MountCallback(bool mount_success, cryptohome::MountError mount_error);
48 51
49 void AttemptRemove(); 52 void AttemptRemove();
50 void RemoveCallback(bool success, 53 void RemoveCallback(bool success,
51 cryptohome::MountError return_code); 54 cryptohome::MountError return_code);
52 55
53 void OnProfilePrepared(Profile* profile); 56 void OnProfilePrepared(Profile* profile);
54 57
55 // The instance of the current running launch.
56 static KioskAppLauncher* running_instance_;
57
58 KioskAppManager* kiosk_app_manager_; 58 KioskAppManager* kiosk_app_manager_;
59 const std::string app_id_; 59 const std::string app_id_;
60 std::string user_id_; 60 std::string user_id_;
61 Delegate* delegate_;
61 62
62 scoped_ptr<CryptohomedChecker> crytohomed_checker; 63 scoped_ptr<CryptohomedChecker> crytohomed_checker;
63 scoped_ptr<ProfileLoader> profile_loader_; 64 scoped_ptr<ProfileLoader> profile_loader_;
64 65
65 // Whether remove existing cryptohome has attempted. 66 // Whether remove existing cryptohome has attempted.
66 bool remove_attempted_; 67 bool remove_attempted_;
67 68
68 DISALLOW_COPY_AND_ASSIGN(KioskAppLauncher); 69 DISALLOW_COPY_AND_ASSIGN(KioskProfileLoader);
69 }; 70 };
70 71
71 } // namespace chromeos 72 } // namespace chromeos
72 73
73 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCHER_H_ 74 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_PROFILE_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698