OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/component_updater/component_updater_service.h" | 5 #include "chrome/browser/component_updater/component_updater_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
947 // |unpacker|. If there is an error this function is in charge of deleting | 947 // |unpacker|. If there is an error this function is in charge of deleting |
948 // the files created. | 948 // the files created. |
949 void CrxUpdateService::Install(scoped_ptr<CRXContext> context, | 949 void CrxUpdateService::Install(scoped_ptr<CRXContext> context, |
950 const base::FilePath& crx_path) { | 950 const base::FilePath& crx_path) { |
951 // This function owns the file at |crx_path| and the |context| object. | 951 // This function owns the file at |crx_path| and the |context| object. |
952 ComponentUnpacker unpacker(context->pk_hash, | 952 ComponentUnpacker unpacker(context->pk_hash, |
953 crx_path, | 953 crx_path, |
954 context->fingerprint, | 954 context->fingerprint, |
955 component_patcher_.get(), | 955 component_patcher_.get(), |
956 context->installer); | 956 context->installer); |
957 if (!base::DeleteFile(crx_path, false)) | 957 component_updater::DeleteFileAndParentDirectoryIfEmpty(crx_path); |
Sorin Jianu
2013/12/15 23:12:35
I will add a unit test to verify this post conditi
Sorin Jianu
2013/12/15 23:15:16
Actually, I can't for now.
| |
958 NOTREACHED() << crx_path.value(); | 958 |
959 // Why unretained? See comment at top of file. | 959 // Why unretained? See comment at top of file. |
960 BrowserThread::PostDelayedTask( | 960 BrowserThread::PostDelayedTask( |
961 BrowserThread::UI, | 961 BrowserThread::UI, |
962 FROM_HERE, | 962 FROM_HERE, |
963 base::Bind(&CrxUpdateService::DoneInstalling, base::Unretained(this), | 963 base::Bind(&CrxUpdateService::DoneInstalling, base::Unretained(this), |
964 context->id, unpacker.error(), unpacker.extended_error()), | 964 context->id, unpacker.error(), unpacker.extended_error()), |
965 base::TimeDelta::FromMilliseconds(config_->StepDelay())); | 965 base::TimeDelta::FromMilliseconds(config_->StepDelay())); |
966 } | 966 } |
967 | 967 |
968 // Installation has been completed. Adjust the component status and | 968 // Installation has been completed. Adjust the component status and |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1092 } | 1092 } |
1093 | 1093 |
1094 // The component update factory. Using the component updater as a singleton | 1094 // The component update factory. Using the component updater as a singleton |
1095 // is the job of the browser process. | 1095 // is the job of the browser process. |
1096 ComponentUpdateService* ComponentUpdateServiceFactory( | 1096 ComponentUpdateService* ComponentUpdateServiceFactory( |
1097 ComponentUpdateService::Configurator* config) { | 1097 ComponentUpdateService::Configurator* config) { |
1098 DCHECK(config); | 1098 DCHECK(config); |
1099 return new CrxUpdateService(config); | 1099 return new CrxUpdateService(config); |
1100 } | 1100 } |
1101 | 1101 |
OLD | NEW |