Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_APP_LAUNCHER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCHER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCHER_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; | |
| 21 | |
| 20 // KioskAppLauncher launches a given app from login screen. It first attempts | 22 // KioskAppLauncher launches a given app from login screen. It first attempts |
| 21 // 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 |
| 22 // app profile then calls StartupAppLauncher to finish the launch. If mount | 24 // app profile then calls StartupAppLauncher to finish the launch. If mount |
| 23 // fails, it sets relevant launch error and restart chrome to gets back to | 25 // fails, it sets relevant launch error and restart chrome to gets back to |
| 24 // the login screen. Note that there should only be one launch attempt in | 26 // the login screen. Note that there should only be one launch attempt in |
| 25 // progress. | 27 // progress. |
| 26 class KioskAppLauncher { | 28 class KioskAppLauncher { |
| 27 public: | 29 public: |
| 28 explicit KioskAppLauncher(const std::string& app_id); | 30 explicit KioskAppLauncher(KioskAppManager* kiosk_app_manager, |
|
Joao da Silva
2013/05/17 18:10:55
nit: no need to be explicit
bartfab (slow)
2013/05/21 13:27:07
Done.
| |
| 31 const std::string& app_id); | |
| 29 | 32 |
| 30 // Starts a launch attempt. Fails immediately if there is already a launch | 33 // Starts a launch attempt. Fails immediately if there is already a launch |
| 31 // attempt running. | 34 // attempt running. |
| 32 void Start(); | 35 void Start(); |
| 33 | 36 |
| 34 private: | 37 private: |
| 35 class CryptohomedChecker; | 38 class CryptohomedChecker; |
| 36 class ProfileLoader; | 39 class ProfileLoader; |
| 37 | 40 |
| 38 // Private dtor because this class manages its own lifetime. | 41 // Private dtor because this class manages its own lifetime. |
| 39 ~KioskAppLauncher(); | 42 ~KioskAppLauncher(); |
| 40 | 43 |
| 41 void ReportLaunchResult(KioskAppLaunchError::Error error); | 44 void ReportLaunchResult(KioskAppLaunchError::Error error); |
| 42 | 45 |
| 43 void StartMount(); | 46 void StartMount(); |
| 44 void MountCallback(bool mount_success, cryptohome::MountError mount_error); | 47 void MountCallback(bool mount_success, cryptohome::MountError mount_error); |
| 45 | 48 |
| 46 void AttemptRemove(); | 49 void AttemptRemove(); |
| 47 void RemoveCallback(bool success, | 50 void RemoveCallback(bool success, |
| 48 cryptohome::MountError return_code); | 51 cryptohome::MountError return_code); |
| 49 | 52 |
| 50 void OnProfilePrepared(Profile* profile); | 53 void OnProfilePrepared(Profile* profile); |
| 51 | 54 |
| 52 // The instance of the current running launch. | 55 // The instance of the current running launch. |
| 53 static KioskAppLauncher* running_instance_; | 56 static KioskAppLauncher* running_instance_; |
| 54 | 57 |
| 58 KioskAppManager* kiosk_app_manager_; | |
| 55 const std::string app_id_; | 59 const std::string app_id_; |
| 56 | 60 |
| 57 scoped_ptr<CryptohomedChecker> crytohomed_checker; | 61 scoped_ptr<CryptohomedChecker> crytohomed_checker; |
| 58 scoped_ptr<ProfileLoader> profile_loader_; | 62 scoped_ptr<ProfileLoader> profile_loader_; |
| 59 | 63 |
| 60 // Whether remove existing cryptohome has attempted. | 64 // Whether remove existing cryptohome has attempted. |
| 61 bool remove_attempted_; | 65 bool remove_attempted_; |
| 62 | 66 |
| 63 DISALLOW_COPY_AND_ASSIGN(KioskAppLauncher); | 67 DISALLOW_COPY_AND_ASSIGN(KioskAppLauncher); |
| 64 }; | 68 }; |
| 65 | 69 |
| 66 } // namespace chromeos | 70 } // namespace chromeos |
| 67 | 71 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCHER_H_ | 72 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCHER_H_ |
| OLD | NEW |