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

Unified Diff: chrome/browser/chromeos/login/app_launch_controller.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/app_launch_controller.h
diff --git a/chrome/browser/chromeos/app_mode/startup_app_launcher.h b/chrome/browser/chromeos/login/app_launch_controller.h
similarity index 59%
rename from chrome/browser/chromeos/app_mode/startup_app_launcher.h
rename to chrome/browser/chromeos/login/app_launch_controller.h
index ac7e5ae67e8196975c824fd7e484e187667518e8..43f861fda4811cebdc476d5836cd2b955f8e5b77 100644
--- a/chrome/browser/chromeos/app_mode/startup_app_launcher.h
+++ b/chrome/browser/chromeos/login/app_launch_controller.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_STARTUP_APP_LAUNCHER_H_
-#define CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_
#include <string>
@@ -12,9 +12,10 @@
#include "base/memory/weak_ptr.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
+#include "chrome/browser/chromeos/app_mode/kiosk_profile_loader.h"
+#include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h"
#include "chrome/browser/signin/oauth2_token_service.h"
#include "net/base/network_change_notifier.h"
-#include "ui/base/events/event_handler.h"
class Profile;
@@ -24,8 +25,12 @@ class WebstoreStandaloneInstaller;
namespace chromeos {
-// Launches the app at startup. The flow roughly looks like this:
+class LoginDisplayHost;
+class OobeDisplay;
+
+// Controls the launch of a kiosk app. The flow roughly looks like this:
// - Starts the app launch splash screen;
+// - Loads the user's profile;
// - Checks if the app is installed in user profile (aka app profile);
// - If the app is installed, launch it and finish the flow;
// - If not installed, prepare to start install by checking network online
@@ -33,17 +38,20 @@ namespace chromeos {
// - If network gets online in time, start to install the app from web store;
// - If all goes good, launches the app and finish the flow;
// If anything goes wrong, it exits app mode and goes back to login screen.
-class StartupAppLauncher
- : public base::SupportsWeakPtr<StartupAppLauncher>,
+class AppLaunchController
+ : public base::SupportsWeakPtr<AppLaunchController>,
public OAuth2TokenService::Observer,
- public net::NetworkChangeNotifier::NetworkChangeObserver,
- public ui::EventHandler {
+ public AppLaunchSplashScreenActor::Delegate,
+ public KioskProfileLoader::Delegate,
+ public net::NetworkChangeNotifier::NetworkChangeObserver {
public:
- StartupAppLauncher(Profile* profile, const std::string& app_id);
+ AppLaunchController(const std::string& app_id,
+ LoginDisplayHost* host,
+ OobeDisplay* oobe_display);
+
+ virtual ~AppLaunchController();
- // Starts app launcher. If |skip_auth_setup| is set, we will skip
- // TokenService initialization.
- void Start();
+ void StartAppLaunch();
private:
// OAuth parameters from /home/chronos/kiosk_auth file.
@@ -53,8 +61,9 @@ class StartupAppLauncher
std::string client_secret;
};
- // Private dtor because this class manages its own lifetime.
- virtual ~StartupAppLauncher();
+ // KioskProfileLoader::Delegate overrides:
+ void OnProfileLoaded(Profile* profile);
+ void OnProfileLoadFailed(KioskAppLaunchError::Error error);
xiyuan 2013/08/15 18:19:42 nit: virtual ... OVERRIDE;
Tim Song 2013/08/16 19:07:59 Done.
void Cleanup();
void OnLaunchSuccess();
@@ -74,29 +83,33 @@ class StartupAppLauncher
static void LoadOAuthFileOnBlockingPool(KioskOAuthParams* auth_params);
void OnOAuthFileLoaded(KioskOAuthParams* auth_params);
- // OAuth2TokenService::Observer overrides.
+ // OAuth2TokenService::Observer overrides:
virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE;
virtual void OnRefreshTokensLoaded() OVERRIDE;
+ // AppLaunchSplashScreenActor::Delegate overrides:
+ virtual void OnConfigureNetwork() OVERRIDE;
+ virtual void OnCancelAppLaunch() OVERRIDE;
+
// net::NetworkChangeNotifier::NetworkChangeObserver overrides:
virtual void OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
- // ui::EventHandler overrides:
- virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
-
Profile* profile_;
- const std::string app_id_;
+ std::string app_id_;
xiyuan 2013/08/15 18:19:42 nit: put back const if |app_id_| is not going to c
Tim Song 2013/08/16 19:07:59 Done.
+ LoginDisplayHost* host_;
+ OobeDisplay* oobe_display_;
+ AppLaunchSplashScreenActor* app_launch_splash_screen_actor_;
int64 launch_splash_start_time_;
scoped_refptr<extensions::WebstoreStandaloneInstaller> installer_;
- base::OneShotTimer<StartupAppLauncher> network_wait_timer_;
+ base::OneShotTimer<AppLaunchController> network_wait_timer_;
KioskOAuthParams auth_params_;
- DISALLOW_COPY_AND_ASSIGN(StartupAppLauncher);
+ DISALLOW_COPY_AND_ASSIGN(AppLaunchController);
};
} // namespace chromeos
-#endif // CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698