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