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 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" | 5 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 UserManager::Get()->SetAppModeChromeClientOAuthInfo( | 141 UserManager::Get()->SetAppModeChromeClientOAuthInfo( |
142 auth_params_.client_id, | 142 auth_params_.client_id, |
143 auth_params_.client_secret); | 143 auth_params_.client_secret); |
144 } | 144 } |
145 | 145 |
146 // If we are restarting chrome (i.e. on crash), we need to initialize | 146 // If we are restarting chrome (i.e. on crash), we need to initialize |
147 // OAuth2TokenService as well. | 147 // OAuth2TokenService as well. |
148 InitializeTokenService(); | 148 InitializeTokenService(); |
149 } | 149 } |
150 | 150 |
| 151 void StartupAppLauncher::RestartLauncher() { |
| 152 // If the installer is still running in the background, we don't need to |
| 153 // restart the launch process. We will just wait until it completes and |
| 154 // lunches the kiosk app. |
| 155 if (installer_ != NULL) { |
| 156 LOG(WARNING) << "Installer still running"; |
| 157 return; |
| 158 } |
| 159 |
| 160 MaybeInitializeNetwork(); |
| 161 } |
| 162 |
151 void StartupAppLauncher::MaybeInitializeNetwork() { | 163 void StartupAppLauncher::MaybeInitializeNetwork() { |
152 network_ready_handled_ = false; | 164 network_ready_handled_ = false; |
153 | 165 |
154 const Extension* extension = extensions::ExtensionSystem::Get(profile_)-> | 166 const Extension* extension = extensions::ExtensionSystem::Get(profile_)-> |
155 extension_service()->GetInstalledExtension(app_id_); | 167 extension_service()->GetInstalledExtension(app_id_); |
156 const bool requires_network = !extension || | 168 const bool requires_network = !extension || |
157 !extensions::OfflineEnabledInfo::IsOfflineEnabled(extension); | 169 !extensions::OfflineEnabledInfo::IsOfflineEnabled(extension); |
158 | 170 |
159 if (requires_network) { | 171 if (requires_network) { |
160 delegate_->InitializeNetwork(); | 172 delegate_->InitializeNetwork(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 app_id_, | 300 app_id_, |
289 profile_, | 301 profile_, |
290 false, | 302 false, |
291 base::Bind(&StartupAppLauncher::InstallCallback, AsWeakPtr())); | 303 base::Bind(&StartupAppLauncher::InstallCallback, AsWeakPtr())); |
292 installer_->BeginInstall(); | 304 installer_->BeginInstall(); |
293 } | 305 } |
294 | 306 |
295 void StartupAppLauncher::InstallCallback(bool success, | 307 void StartupAppLauncher::InstallCallback(bool success, |
296 const std::string& error) { | 308 const std::string& error) { |
297 installer_ = NULL; | 309 installer_ = NULL; |
| 310 if (delegate_->IsShowingNetworkConfigScreen()) { |
| 311 LOG(WARNING) << "Showing network config screen"; |
| 312 return; |
| 313 } |
| 314 |
298 if (success) { | 315 if (success) { |
299 // Finish initialization after the callback returns. | 316 // Finish initialization after the callback returns. |
300 // So that the app finishes its installation. | 317 // So that the app finishes its installation. |
301 BrowserThread::PostTask( | 318 BrowserThread::PostTask( |
302 BrowserThread::UI, | 319 BrowserThread::UI, |
303 FROM_HERE, | 320 FROM_HERE, |
304 base::Bind(&StartupAppLauncher::OnReadyToLaunch, | 321 base::Bind(&StartupAppLauncher::OnReadyToLaunch, |
305 AsWeakPtr())); | 322 AsWeakPtr())); |
306 return; | 323 return; |
307 } | 324 } |
(...skipping 18 matching lines...) Expand all Loading... |
326 ready_to_launch_ = true; | 343 ready_to_launch_ = true; |
327 delegate_->OnReadyToLaunch(); | 344 delegate_->OnReadyToLaunch(); |
328 } | 345 } |
329 | 346 |
330 void StartupAppLauncher::UpdateAppData() { | 347 void StartupAppLauncher::UpdateAppData() { |
331 KioskAppManager::Get()->ClearAppData(app_id_); | 348 KioskAppManager::Get()->ClearAppData(app_id_); |
332 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); | 349 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); |
333 } | 350 } |
334 | 351 |
335 } // namespace chromeos | 352 } // namespace chromeos |
OLD | NEW |