| 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 | |
| 163 void StartupAppLauncher::MaybeInitializeNetwork() { | 151 void StartupAppLauncher::MaybeInitializeNetwork() { |
| 164 network_ready_handled_ = false; | 152 network_ready_handled_ = false; |
| 165 | 153 |
| 166 const Extension* extension = extensions::ExtensionSystem::Get(profile_)-> | 154 const Extension* extension = extensions::ExtensionSystem::Get(profile_)-> |
| 167 extension_service()->GetInstalledExtension(app_id_); | 155 extension_service()->GetInstalledExtension(app_id_); |
| 168 const bool requires_network = !extension || | 156 const bool requires_network = !extension || |
| 169 !extensions::OfflineEnabledInfo::IsOfflineEnabled(extension); | 157 !extensions::OfflineEnabledInfo::IsOfflineEnabled(extension); |
| 170 | 158 |
| 171 if (requires_network) { | 159 if (requires_network) { |
| 172 delegate_->InitializeNetwork(); | 160 delegate_->InitializeNetwork(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 app_id_, | 288 app_id_, |
| 301 profile_, | 289 profile_, |
| 302 false, | 290 false, |
| 303 base::Bind(&StartupAppLauncher::InstallCallback, AsWeakPtr())); | 291 base::Bind(&StartupAppLauncher::InstallCallback, AsWeakPtr())); |
| 304 installer_->BeginInstall(); | 292 installer_->BeginInstall(); |
| 305 } | 293 } |
| 306 | 294 |
| 307 void StartupAppLauncher::InstallCallback(bool success, | 295 void StartupAppLauncher::InstallCallback(bool success, |
| 308 const std::string& error) { | 296 const std::string& error) { |
| 309 installer_ = NULL; | 297 installer_ = NULL; |
| 310 if (delegate_->IsShowingNetworkConfigScreen()) { | |
| 311 LOG(WARNING) << "Showing network config screen"; | |
| 312 return; | |
| 313 } | |
| 314 | |
| 315 if (success) { | 298 if (success) { |
| 316 // Finish initialization after the callback returns. | 299 // Finish initialization after the callback returns. |
| 317 // So that the app finishes its installation. | 300 // So that the app finishes its installation. |
| 318 BrowserThread::PostTask( | 301 BrowserThread::PostTask( |
| 319 BrowserThread::UI, | 302 BrowserThread::UI, |
| 320 FROM_HERE, | 303 FROM_HERE, |
| 321 base::Bind(&StartupAppLauncher::OnReadyToLaunch, | 304 base::Bind(&StartupAppLauncher::OnReadyToLaunch, |
| 322 AsWeakPtr())); | 305 AsWeakPtr())); |
| 323 return; | 306 return; |
| 324 } | 307 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 343 ready_to_launch_ = true; | 326 ready_to_launch_ = true; |
| 344 delegate_->OnReadyToLaunch(); | 327 delegate_->OnReadyToLaunch(); |
| 345 } | 328 } |
| 346 | 329 |
| 347 void StartupAppLauncher::UpdateAppData() { | 330 void StartupAppLauncher::UpdateAppData() { |
| 348 KioskAppManager::Get()->ClearAppData(app_id_); | 331 KioskAppManager::Get()->ClearAppData(app_id_); |
| 349 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); | 332 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); |
| 350 } | 333 } |
| 351 | 334 |
| 352 } // namespace chromeos | 335 } // namespace chromeos |
| OLD | NEW |