| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/kiosk_external_updater.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_external_updater.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 return true; | 86 return true; |
| 87 else | 87 else |
| 88 return false; | 88 return false; |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace | 91 } // namespace |
| 92 | 92 |
| 93 KioskExternalUpdater::ExternalUpdate::ExternalUpdate() { | 93 KioskExternalUpdater::ExternalUpdate::ExternalUpdate() { |
| 94 } | 94 } |
| 95 | 95 |
| 96 KioskExternalUpdater::ExternalUpdate::~ExternalUpdate() { |
| 97 } |
| 98 |
| 96 KioskExternalUpdater::KioskExternalUpdater( | 99 KioskExternalUpdater::KioskExternalUpdater( |
| 97 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner, | 100 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner, |
| 98 const base::FilePath& crx_cache_dir, | 101 const base::FilePath& crx_cache_dir, |
| 99 const base::FilePath& crx_unpack_dir) | 102 const base::FilePath& crx_unpack_dir) |
| 100 : backend_task_runner_(backend_task_runner), | 103 : backend_task_runner_(backend_task_runner), |
| 101 crx_cache_dir_(crx_cache_dir), | 104 crx_cache_dir_(crx_cache_dir), |
| 102 crx_unpack_dir_(crx_unpack_dir), | 105 crx_unpack_dir_(crx_unpack_dir), |
| 103 weak_factory_(this) { | 106 weak_factory_(this) { |
| 104 // Subscribe to DiskMountManager. | 107 // Subscribe to DiskMountManager. |
| 105 DCHECK(disks::DiskMountManager::GetInstance()); | 108 DCHECK(disks::DiskMountManager::GetInstance()); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 321 |
| 319 return false; | 322 return false; |
| 320 } | 323 } |
| 321 | 324 |
| 322 void KioskExternalUpdater::ValidateExternalUpdates() { | 325 void KioskExternalUpdater::ValidateExternalUpdates() { |
| 323 for (ExternalUpdateMap::iterator it = external_updates_.begin(); | 326 for (ExternalUpdateMap::iterator it = external_updates_.begin(); |
| 324 it != external_updates_.end(); | 327 it != external_updates_.end(); |
| 325 ++it) { | 328 ++it) { |
| 326 if (it->second.update_status == PENDING) { | 329 if (it->second.update_status == PENDING) { |
| 327 scoped_refptr<KioskExternalUpdateValidator> crx_validator = | 330 scoped_refptr<KioskExternalUpdateValidator> crx_validator = |
| 328 new KioskExternalUpdateValidator(backend_task_runner_, | 331 new KioskExternalUpdateValidator( |
| 329 it->first, | 332 backend_task_runner_, it->first, it->second.external_crx, |
| 330 it->second.external_crx, | 333 it->second.package_hash, crx_unpack_dir_, |
| 331 crx_unpack_dir_, | 334 weak_factory_.GetWeakPtr()); |
| 332 weak_factory_.GetWeakPtr()); | |
| 333 crx_validator->Start(); | 335 crx_validator->Start(); |
| 334 break; | 336 break; |
| 335 } | 337 } |
| 336 } | 338 } |
| 337 } | 339 } |
| 338 | 340 |
| 339 bool KioskExternalUpdater::IsExternalUpdatePending() { | 341 bool KioskExternalUpdater::IsExternalUpdatePending() { |
| 340 for (ExternalUpdateMap::iterator it = external_updates_.begin(); | 342 for (ExternalUpdateMap::iterator it = external_updates_.begin(); |
| 341 it != external_updates_.end(); | 343 it != external_updates_.end(); |
| 342 ++it) { | 344 ++it) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 if (failed) { | 523 if (failed) { |
| 522 failed_app_msg = ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | 524 failed_app_msg = ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
| 523 IDS_KIOSK_EXTERNAL_UPDATE_FAILED_UPDATED_APPS) + | 525 IDS_KIOSK_EXTERNAL_UPDATE_FAILED_UPDATED_APPS) + |
| 524 base::ASCIIToUTF16("\n") + failed_apps; | 526 base::ASCIIToUTF16("\n") + failed_apps; |
| 525 message = message + base::ASCIIToUTF16("\n") + failed_app_msg; | 527 message = message + base::ASCIIToUTF16("\n") + failed_app_msg; |
| 526 } | 528 } |
| 527 return message; | 529 return message; |
| 528 } | 530 } |
| 529 | 531 |
| 530 } // namespace chromeos | 532 } // namespace chromeos |
| OLD | NEW |