| 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_update_validator.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_external_update_validator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
| 11 #include "extensions/common/manifest_constants.h" | 11 #include "extensions/common/manifest_constants.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 KioskExternalUpdateValidator::KioskExternalUpdateValidator( | 15 KioskExternalUpdateValidator::KioskExternalUpdateValidator( |
| 16 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner, | 16 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner, |
| 17 const std::string& app_id, | 17 const std::string& app_id, |
| 18 const base::FilePath& crx_dir, | 18 const base::FilePath& crx_dir, |
| 19 const std::string& crx_hash, |
| 19 const base::FilePath& crx_unpack_dir, | 20 const base::FilePath& crx_unpack_dir, |
| 20 const base::WeakPtr<KioskExternalUpdateValidatorDelegate>& delegate) | 21 const base::WeakPtr<KioskExternalUpdateValidatorDelegate>& delegate) |
| 21 : backend_task_runner_(backend_task_runner), | 22 : backend_task_runner_(backend_task_runner), |
| 22 app_id_(app_id), | 23 app_id_(app_id), |
| 23 crx_dir_(crx_dir), | 24 crx_dir_(crx_dir), |
| 25 crx_hash_(crx_hash), |
| 24 crx_unpack_dir_(crx_unpack_dir), | 26 crx_unpack_dir_(crx_unpack_dir), |
| 25 delegate_(delegate) { | 27 delegate_(delegate) { |
| 26 } | 28 } |
| 27 | 29 |
| 28 KioskExternalUpdateValidator::~KioskExternalUpdateValidator() { | 30 KioskExternalUpdateValidator::~KioskExternalUpdateValidator() { |
| 29 } | 31 } |
| 30 | 32 |
| 31 void KioskExternalUpdateValidator::Start() { | 33 void KioskExternalUpdateValidator::Start() { |
| 32 scoped_refptr<extensions::SandboxedUnpacker> unpacker( | 34 scoped_refptr<extensions::SandboxedUnpacker> unpacker( |
| 33 new extensions::SandboxedUnpacker(crx_dir_, | 35 new extensions::SandboxedUnpacker( |
| 34 extensions::Manifest::EXTERNAL_PREF, | 36 crx_dir_, crx_hash_, extensions::Manifest::EXTERNAL_PREF, |
| 35 extensions::Extension::NO_FLAGS, | 37 extensions::Extension::NO_FLAGS, crx_unpack_dir_, |
| 36 crx_unpack_dir_, | 38 backend_task_runner_.get(), this)); |
| 37 backend_task_runner_.get(), | |
| 38 this)); | |
| 39 if (!backend_task_runner_->PostTask( | 39 if (!backend_task_runner_->PostTask( |
| 40 FROM_HERE, | 40 FROM_HERE, |
| 41 base::Bind(&extensions::SandboxedUnpacker::Start, unpacker.get()))) { | 41 base::Bind(&extensions::SandboxedUnpacker::Start, unpacker.get()))) { |
| 42 NOTREACHED(); | 42 NOTREACHED(); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void KioskExternalUpdateValidator::OnUnpackFailure( | 46 void KioskExternalUpdateValidator::OnUnpackFailure( |
| 47 const base::string16& error_message) { | 47 const base::string16& error_message) { |
| 48 LOG(ERROR) << "Failed to unpack external kiosk crx file: " << app_id_ << " " | 48 LOG(ERROR) << "Failed to unpack external kiosk crx file: " << app_id_ << " " |
| (...skipping 29 matching lines...) Expand all Loading... |
| 78 base::Bind( | 78 base::Bind( |
| 79 &KioskExternalUpdateValidatorDelegate::OnExtenalUpdateUnpackSuccess, | 79 &KioskExternalUpdateValidatorDelegate::OnExtenalUpdateUnpackSuccess, |
| 80 delegate_, | 80 delegate_, |
| 81 app_id_, | 81 app_id_, |
| 82 extension->VersionString(), | 82 extension->VersionString(), |
| 83 minimum_browser_version, | 83 minimum_browser_version, |
| 84 temp_dir)); | 84 temp_dir)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace chromeos | 87 } // namespace chromeos |
| OLD | NEW |