Index: chrome/browser/chromeos/app_mode/kiosk_profile_loader.h |
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_launcher.h b/chrome/browser/chromeos/app_mode/kiosk_profile_loader.h |
similarity index 59% |
rename from chrome/browser/chromeos/app_mode/kiosk_app_launcher.h |
rename to chrome/browser/chromeos/app_mode/kiosk_profile_loader.h |
index 5b9908f7b824833a3498a64ac91356e67aec27f1..048796bce696362c496cd32eb5b4be81b37591c6 100644 |
--- a/chrome/browser/chromeos/app_mode/kiosk_app_launcher.h |
+++ b/chrome/browser/chromeos/app_mode/kiosk_profile_loader.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCHER_H_ |
-#define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCHER_H_ |
+#ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_PROFILE_LOADER_H_ |
+#define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_PROFILE_LOADER_H_ |
#include <string> |
@@ -19,19 +19,22 @@ namespace chromeos { |
class KioskAppManager; |
-// KioskAppLauncher launches a given app from login screen. It first attempts |
+// KioskProfileLoader loads a special profile for a given app. It first attempts |
// to mount a cryptohome for the app. If the mount is successful, it prepares |
-// app profile then calls StartupAppLauncher to finish the launch. If mount |
-// fails, it sets relevant launch error and restart chrome to gets back to |
-// the login screen. Note that there should only be one launch attempt in |
-// progress. |
-class KioskAppLauncher { |
+// app profile then calls the delegate. |
+class KioskProfileLoader { |
public: |
- KioskAppLauncher(KioskAppManager* kiosk_app_manager, |
- const std::string& app_id); |
+ class Delegate { |
+ public: |
+ virtual void OnProfileLoaded(Profile* profile) = 0; |
+ virtual void OnProfileLoadFailed(KioskAppLaunchError::Error error) = 0; |
+ }; |
xiyuan
2013/08/15 18:19:42
nit: add a dtor
protected:
virtual ~Delegate()
Tim Song
2013/08/16 19:07:59
Done.
|
- // Starts a launch attempt. Fails immediately if there is already a launch |
- // attempt running. |
+ KioskProfileLoader(KioskAppManager* kiosk_app_manager, |
+ const std::string& app_id, |
+ Delegate* delegate); |
+ |
+ // Starts profile load. Calls delegate on success or failure. |
void Start(); |
private: |
@@ -39,7 +42,7 @@ class KioskAppLauncher { |
class ProfileLoader; |
// Private dtor because this class manages its own lifetime. |
- ~KioskAppLauncher(); |
+ ~KioskProfileLoader(); |
void ReportLaunchResult(KioskAppLaunchError::Error error); |
@@ -52,12 +55,10 @@ class KioskAppLauncher { |
void OnProfilePrepared(Profile* profile); |
- // The instance of the current running launch. |
- static KioskAppLauncher* running_instance_; |
- |
KioskAppManager* kiosk_app_manager_; |
const std::string app_id_; |
std::string user_id_; |
+ Delegate* delegate_; |
scoped_ptr<CryptohomedChecker> crytohomed_checker; |
scoped_ptr<ProfileLoader> profile_loader_; |
@@ -65,9 +66,9 @@ class KioskAppLauncher { |
// Whether remove existing cryptohome has attempted. |
bool remove_attempted_; |
- DISALLOW_COPY_AND_ASSIGN(KioskAppLauncher); |
+ DISALLOW_COPY_AND_ASSIGN(KioskProfileLoader); |
}; |
} // namespace chromeos |
-#endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCHER_H_ |
+#endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_PROFILE_LOADER_H_ |