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_STARTUP_APP_LAUNCHER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void LaunchApp(); | 67 void LaunchApp(); |
68 | 68 |
69 private: | 69 private: |
70 // OAuth parameters from /home/chronos/kiosk_auth file. | 70 // OAuth parameters from /home/chronos/kiosk_auth file. |
71 struct KioskOAuthParams { | 71 struct KioskOAuthParams { |
72 std::string refresh_token; | 72 std::string refresh_token; |
73 std::string client_id; | 73 std::string client_id; |
74 std::string client_secret; | 74 std::string client_secret; |
75 }; | 75 }; |
76 | 76 |
| 77 // A class to check if the app has an update. It invokes BeginInstall |
| 78 // if the app is not installed or not up-to-date. Otherwise, it invokes |
| 79 // OnReadyToLaunch. |
| 80 class AppUpdateChecker; |
| 81 |
77 void OnLaunchSuccess(); | 82 void OnLaunchSuccess(); |
78 void OnLaunchFailure(KioskAppLaunchError::Error error); | 83 void OnLaunchFailure(KioskAppLaunchError::Error error); |
79 | 84 |
| 85 void MaybeInstall(); |
| 86 |
| 87 // Callbacks from AppUpdateChecker |
| 88 void OnUpdateCheckNotInstalled(); |
| 89 void OnUpdateCheckUpdateAvailable(); |
| 90 void OnUpdateCheckNoUpdate(); |
| 91 |
80 void BeginInstall(); | 92 void BeginInstall(); |
81 void InstallCallback(bool success, const std::string& error); | 93 void InstallCallback(bool success, const std::string& error); |
82 void OnReadyToLaunch(); | 94 void OnReadyToLaunch(); |
| 95 void UpdateAppData(); |
83 | 96 |
84 void InitializeTokenService(); | 97 void InitializeTokenService(); |
85 void InitializeNetwork(); | 98 void InitializeNetwork(); |
86 | 99 |
87 void StartLoadingOAuthFile(); | 100 void StartLoadingOAuthFile(); |
88 static void LoadOAuthFileOnBlockingPool(KioskOAuthParams* auth_params); | 101 static void LoadOAuthFileOnBlockingPool(KioskOAuthParams* auth_params); |
89 void OnOAuthFileLoaded(KioskOAuthParams* auth_params); | 102 void OnOAuthFileLoaded(KioskOAuthParams* auth_params); |
90 | 103 |
91 // OAuth2TokenService::Observer overrides. | 104 // OAuth2TokenService::Observer overrides. |
92 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; | 105 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; |
93 virtual void OnRefreshTokensLoaded() OVERRIDE; | 106 virtual void OnRefreshTokensLoaded() OVERRIDE; |
94 | 107 |
95 Profile* profile_; | 108 Profile* profile_; |
96 const std::string app_id_; | 109 const std::string app_id_; |
97 Delegate* delegate_; | 110 Delegate* delegate_; |
98 bool install_attempted_; | 111 bool install_attempted_; |
99 bool ready_to_launch_; | 112 bool ready_to_launch_; |
100 | 113 |
101 scoped_refptr<extensions::WebstoreStandaloneInstaller> installer_; | 114 scoped_refptr<extensions::WebstoreStandaloneInstaller> installer_; |
102 KioskOAuthParams auth_params_; | 115 KioskOAuthParams auth_params_; |
103 | 116 |
| 117 scoped_ptr<AppUpdateChecker> update_checker_; |
| 118 |
104 DISALLOW_COPY_AND_ASSIGN(StartupAppLauncher); | 119 DISALLOW_COPY_AND_ASSIGN(StartupAppLauncher); |
105 }; | 120 }; |
106 | 121 |
107 } // namespace chromeos | 122 } // namespace chromeos |
108 | 123 |
109 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_ | 124 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_ |
OLD | NEW |