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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 delegate_->OnLaunchSucceeded(); | 351 delegate_->OnLaunchSucceeded(); |
352 } | 352 } |
353 | 353 |
354 void StartupAppLauncher::OnLaunchFailure(KioskAppLaunchError::Error error) { | 354 void StartupAppLauncher::OnLaunchFailure(KioskAppLaunchError::Error error) { |
355 LOG(ERROR) << "App launch failed, error: " << error; | 355 LOG(ERROR) << "App launch failed, error: " << error; |
356 DCHECK_NE(KioskAppLaunchError::NONE, error); | 356 DCHECK_NE(KioskAppLaunchError::NONE, error); |
357 | 357 |
358 delegate_->OnLaunchFailed(error); | 358 delegate_->OnLaunchFailed(error); |
359 } | 359 } |
360 | 360 |
361 void StartupAppLauncher::OnUpdateCheckFinished() { | |
362 OnReadyToLaunch(); | |
363 UpdateAppData(); | |
364 } | |
365 | |
366 void StartupAppLauncher::BeginInstall() { | 361 void StartupAppLauncher::BeginInstall() { |
367 KioskAppManager::Get()->InstallFromCache(app_id_); | 362 KioskAppManager::Get()->InstallFromCache(app_id_); |
368 if (extensions::ExtensionSystem::Get(profile_) | 363 if (extensions::ExtensionSystem::Get(profile_) |
369 ->extension_service() | 364 ->extension_service() |
370 ->pending_extension_manager() | 365 ->pending_extension_manager() |
371 ->IsIdPending(app_id_)) { | 366 ->IsIdPending(app_id_)) { |
372 delegate_->OnInstallingApp(); | 367 delegate_->OnInstallingApp(); |
373 // Observe the crx installation events. | 368 // Observe the crx installation events. |
374 extensions::InstallTracker* tracker = | 369 extensions::InstallTracker* tracker = |
375 extensions::InstallTrackerFactory::GetForBrowserContext(profile_); | 370 extensions::InstallTrackerFactory::GetForBrowserContext(profile_); |
376 tracker->AddObserver(this); | 371 tracker->AddObserver(this); |
377 return; | 372 return; |
378 } | 373 } |
379 | 374 |
380 if (extensions::ExtensionSystem::Get(profile_) | 375 if (extensions::ExtensionSystem::Get(profile_) |
381 ->extension_service() | 376 ->extension_service() |
382 ->GetInstalledExtension(app_id_)) { | 377 ->GetInstalledExtension(app_id_)) { |
383 // Launch the app. | 378 // Launch the app. |
384 OnReadyToLaunch(); | 379 OnReadyToLaunch(); |
385 } else { | 380 } else { |
386 // The extension is skipped for installation due to some error. | 381 // The extension is skipped for installation due to some error. |
387 OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_INSTALL); | 382 OnLaunchFailure(KioskAppLaunchError::UNABLE_TO_INSTALL); |
388 } | 383 } |
389 } | 384 } |
390 | 385 |
391 void StartupAppLauncher::OnReadyToLaunch() { | 386 void StartupAppLauncher::OnReadyToLaunch() { |
392 ready_to_launch_ = true; | 387 ready_to_launch_ = true; |
| 388 UpdateAppData(); |
393 delegate_->OnReadyToLaunch(); | 389 delegate_->OnReadyToLaunch(); |
394 } | 390 } |
395 | 391 |
396 void StartupAppLauncher::UpdateAppData() { | 392 void StartupAppLauncher::UpdateAppData() { |
397 KioskAppManager::Get()->ClearAppData(app_id_); | 393 KioskAppManager::Get()->ClearAppData(app_id_); |
398 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); | 394 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); |
399 } | 395 } |
400 | 396 |
401 } // namespace chromeos | 397 } // namespace chromeos |
OLD | NEW |