This source file includes following definitions.
- Start
- Cleanup
- InitializeNetwork
- IsNetworkReady
- OnLoadingOAuthFile
- OnInitializingTokenService
- OnInstallingApp
- OnReadyToLaunch
- OnLaunchSucceeded
- OnLaunchFailed
- IsShowingNetworkConfigScreen
- LaunchAppOrDie
#include "chrome/browser/chromeos/app_mode/app_launch_utils.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
#include "chrome/browser/chromeos/app_mode/startup_app_launcher.h"
#include "chrome/browser/lifetime/application_lifetime.h"
namespace chromeos {
class AppLaunchManager : public StartupAppLauncher::Delegate {
public:
AppLaunchManager(Profile* profile, const std::string& app_id)
: startup_app_launcher_(
new StartupAppLauncher(profile,
app_id,
false ,
this)) {}
void Start() {
startup_app_launcher_->Initialize();
}
private:
virtual ~AppLaunchManager() {}
void Cleanup() { delete this; }
virtual void InitializeNetwork() OVERRIDE {
startup_app_launcher_->ContinueWithNetworkReady();
}
virtual bool IsNetworkReady() OVERRIDE {
return true;
}
virtual void OnLoadingOAuthFile() OVERRIDE {}
virtual void OnInitializingTokenService() OVERRIDE {}
virtual void OnInstallingApp() OVERRIDE {}
virtual void OnReadyToLaunch() OVERRIDE {
startup_app_launcher_->LaunchApp();
}
virtual void OnLaunchSucceeded() OVERRIDE { Cleanup(); }
virtual void OnLaunchFailed(KioskAppLaunchError::Error error) OVERRIDE {
KioskAppLaunchError::Save(error);
chrome::AttemptUserExit();
Cleanup();
}
virtual bool IsShowingNetworkConfigScreen() OVERRIDE { return false; }
scoped_ptr<StartupAppLauncher> startup_app_launcher_;
DISALLOW_COPY_AND_ASSIGN(AppLaunchManager);
};
void LaunchAppOrDie(Profile* profile, const std::string& app_id) {
(new AppLaunchManager(profile, app_id))->Start();
}
}