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

Side by Side Diff: chrome/browser/chromeos/login/app_launch_controller.h

Issue 79113002: kiosk: Network connectivity test during launch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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_LOGIN_APP_LAUNCH_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_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_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" 15 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
16 #include "chrome/browser/chromeos/app_mode/kiosk_profile_loader.h" 16 #include "chrome/browser/chromeos/app_mode/kiosk_profile_loader.h"
17 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" 17 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h"
18 #include "chrome/browser/chromeos/login/app_launch_signin_screen.h" 18 #include "chrome/browser/chromeos/login/app_launch_signin_screen.h"
19 #include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h " 19 #include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h "
20 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h"
21 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
23 22
24 class Profile; 23 class Profile;
25 24
26 namespace chromeos { 25 namespace chromeos {
27 26
28 class LoginDisplayHost; 27 class LoginDisplayHost;
29 class OobeDisplay; 28 class OobeDisplay;
30 class UserManager; 29 class UserManager;
31 30
32 // Controller for the kiosk app launch process, responsible for 31 // Controller for the kiosk app launch process, responsible for
33 // coordinating loading the kiosk profile, launching the app, and 32 // coordinating loading the kiosk profile, launching the app, and
34 // updating the splash screen UI. 33 // updating the splash screen UI.
35 class AppLaunchController 34 class AppLaunchController
36 : public base::SupportsWeakPtr<AppLaunchController>, 35 : public base::SupportsWeakPtr<AppLaunchController>,
37 public AppLaunchSplashScreenActor::Delegate, 36 public AppLaunchSplashScreenActor::Delegate,
38 public KioskProfileLoader::Delegate, 37 public KioskProfileLoader::Delegate,
39 public StartupAppLauncher::Observer, 38 public StartupAppLauncher::Delegate,
40 public AppLaunchSigninScreen::Delegate, 39 public AppLaunchSigninScreen::Delegate,
41 public content::NotificationObserver { 40 public content::NotificationObserver {
42 public: 41 public:
43 typedef base::Callback<bool()> CanConfigureNetworkCallback; 42 typedef base::Callback<bool()> ReturnBoolCallback;
44 43
45 AppLaunchController(const std::string& app_id, 44 AppLaunchController(const std::string& app_id,
46 LoginDisplayHost* host, 45 LoginDisplayHost* host,
47 OobeDisplay* oobe_display); 46 OobeDisplay* oobe_display);
48 47
49 virtual ~AppLaunchController(); 48 virtual ~AppLaunchController();
50 49
51 void StartAppLaunch(); 50 void StartAppLaunch();
52 51
53 bool waiting_for_network() { return waiting_for_network_; } 52 bool waiting_for_network() { return waiting_for_network_; }
54 bool network_wait_timedout() { return network_wait_timedout_; } 53 bool network_wait_timedout() { return network_wait_timedout_; }
55 bool showing_network_dialog() { return showing_network_dialog_; } 54 bool showing_network_dialog() { return showing_network_dialog_; }
56 55
57 // Customize controller for testing purposes. 56 // Customize controller for testing purposes.
58 static void SkipSplashWaitForTesting(); 57 static void SkipSplashWaitForTesting();
59 static void SetNetworkTimeoutCallbackForTesting(base::Closure* callback); 58 static void SetNetworkTimeoutCallbackForTesting(base::Closure* callback);
60 static void SetNetworkWaitForTesting(int wait_time_secs); 59 static void SetNetworkWaitForTesting(int wait_time_secs);
61 static void SetCanConfigureNetworkCallbackForTesting( 60 static void SetCanConfigureNetworkCallbackForTesting(
62 CanConfigureNetworkCallback* can_configure_network_callback); 61 ReturnBoolCallback* can_configure_network_callback);
62 static void SetNeedOwnerAuthToConfigureNetworkCallbackForTesting(
63 ReturnBoolCallback* need_owner_auth_callback);
63 64
64 private: 65 private:
65 // A class to watch app window creation. 66 // A class to watch app window creation.
66 class AppWindowWatcher; 67 class AppWindowWatcher;
67 68
68 void CleanUp(); 69 void CleanUp();
69 void OnNetworkWaitTimedout(); 70 void OnNetworkWaitTimedout();
70 71
71 // Callback of AppWindowWatcher to notify an app window is created. 72 // Callback of AppWindowWatcher to notify an app window is created.
72 void OnAppWindowCreated(); 73 void OnAppWindowCreated();
73 74
74 // Whether the network could be configured during launching. 75 // Whether the network could be configured during launching.
75 bool CanConfigureNetwork(); 76 bool CanConfigureNetwork();
76 77
78 // Whether the owner password is needed to configure network.
79 bool NeedOwnerAuthToConfigureNetwork();
80
81 // Show network configuration UI if it is allowed. For consumer mode,
82 // owner password might be checked before showing the network configure UI.
83 void MaybeShowNetworkConfigureUI();
84
77 // KioskProfileLoader::Delegate overrides: 85 // KioskProfileLoader::Delegate overrides:
78 virtual void OnProfileLoaded(Profile* profile) OVERRIDE; 86 virtual void OnProfileLoaded(Profile* profile) OVERRIDE;
79 virtual void OnProfileLoadFailed(KioskAppLaunchError::Error error) OVERRIDE; 87 virtual void OnProfileLoadFailed(KioskAppLaunchError::Error error) OVERRIDE;
80 88
81 // AppLaunchSplashScreenActor::Delegate overrides: 89 // AppLaunchSplashScreenActor::Delegate overrides:
82 virtual void OnConfigureNetwork() OVERRIDE; 90 virtual void OnConfigureNetwork() OVERRIDE;
83 virtual void OnCancelAppLaunch() OVERRIDE; 91 virtual void OnCancelAppLaunch() OVERRIDE;
92 virtual void OnNetworkStateChanged(bool online) OVERRIDE;
84 93
85 // StartupAppLauncher::Observer overrides: 94 // StartupAppLauncher::Delegate overrides:
95 virtual void InitializeNetwork() OVERRIDE;
86 virtual void OnLoadingOAuthFile() OVERRIDE; 96 virtual void OnLoadingOAuthFile() OVERRIDE;
87 virtual void OnInitializingTokenService() OVERRIDE; 97 virtual void OnInitializingTokenService() OVERRIDE;
88 virtual void OnInitializingNetwork() OVERRIDE;
89 virtual void OnInstallingApp() OVERRIDE; 98 virtual void OnInstallingApp() OVERRIDE;
90 virtual void OnReadyToLaunch() OVERRIDE; 99 virtual void OnReadyToLaunch() OVERRIDE;
91 virtual void OnLaunchSucceeded() OVERRIDE; 100 virtual void OnLaunchSucceeded() OVERRIDE;
92 virtual void OnLaunchFailed(KioskAppLaunchError::Error error) OVERRIDE; 101 virtual void OnLaunchFailed(KioskAppLaunchError::Error error) OVERRIDE;
93 102
94 // AppLaunchSigninScreen::Delegate overrides: 103 // AppLaunchSigninScreen::Delegate overrides:
95 virtual void OnOwnerSigninSuccess() OVERRIDE; 104 virtual void OnOwnerSigninSuccess() OVERRIDE;
96 105
97 // content::NotificationObserver overrides: 106 // content::NotificationObserver overrides:
98 virtual void Observe(int type, 107 virtual void Observe(int type,
99 const content::NotificationSource& source, 108 const content::NotificationSource& source,
100 const content::NotificationDetails& details) OVERRIDE; 109 const content::NotificationDetails& details) OVERRIDE;
101 110
102 Profile* profile_; 111 Profile* profile_;
103 const std::string app_id_; 112 const std::string app_id_;
104 LoginDisplayHost* host_; 113 LoginDisplayHost* host_;
105 OobeDisplay* oobe_display_; 114 OobeDisplay* oobe_display_;
106 AppLaunchSplashScreenActor* app_launch_splash_screen_actor_; 115 AppLaunchSplashScreenActor* app_launch_splash_screen_actor_;
107 ErrorScreenActor* error_screen_actor_;
108 scoped_ptr<KioskProfileLoader> kiosk_profile_loader_; 116 scoped_ptr<KioskProfileLoader> kiosk_profile_loader_;
109 scoped_ptr<StartupAppLauncher> startup_app_launcher_; 117 scoped_ptr<StartupAppLauncher> startup_app_launcher_;
110 scoped_ptr<AppLaunchSigninScreen> signin_screen_; 118 scoped_ptr<AppLaunchSigninScreen> signin_screen_;
111 scoped_ptr<AppWindowWatcher> app_window_watcher_; 119 scoped_ptr<AppWindowWatcher> app_window_watcher_;
112 120
113 content::NotificationRegistrar registrar_; 121 content::NotificationRegistrar registrar_;
114 bool webui_visible_; 122 bool webui_visible_;
115 bool launcher_ready_; 123 bool launcher_ready_;
116 124
117 base::OneShotTimer<AppLaunchController> network_wait_timer_; 125 base::OneShotTimer<AppLaunchController> network_wait_timer_;
118 bool waiting_for_network_; 126 bool waiting_for_network_;
119 bool network_wait_timedout_; 127 bool network_wait_timedout_;
120 bool showing_network_dialog_; 128 bool showing_network_dialog_;
121 int64 launch_splash_start_time_; 129 int64 launch_splash_start_time_;
122 130
123 static bool skip_splash_wait_; 131 static bool skip_splash_wait_;
124 static int network_wait_time_; 132 static int network_wait_time_;
125 static base::Closure* network_timeout_callback_; 133 static base::Closure* network_timeout_callback_;
126 static CanConfigureNetworkCallback* can_configure_network_callback_; 134 static ReturnBoolCallback* can_configure_network_callback_;
135 static ReturnBoolCallback* need_owner_auth_to_configure_network_callback_;
127 136
128 DISALLOW_COPY_AND_ASSIGN(AppLaunchController); 137 DISALLOW_COPY_AND_ASSIGN(AppLaunchController);
129 }; 138 };
130 139
131 } // namespace chromeos 140 } // namespace chromeos
132 141
133 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_ 142 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/app_mode/startup_app_launcher.cc ('k') | chrome/browser/chromeos/login/app_launch_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698