| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "extensions/browser/updater/update_data_provider.h" | 5 #include "extensions/browser/updater/update_data_provider.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 if (!extension) | 41 if (!extension) |
| 42 continue; | 42 continue; |
| 43 data->push_back(update_client::CrxComponent()); | 43 data->push_back(update_client::CrxComponent()); |
| 44 update_client::CrxComponent* info = &data->back(); | 44 update_client::CrxComponent* info = &data->back(); |
| 45 std::string pubkey_bytes; | 45 std::string pubkey_bytes; |
| 46 base::Base64Decode(extension->public_key(), &pubkey_bytes); | 46 base::Base64Decode(extension->public_key(), &pubkey_bytes); |
| 47 info->pk_hash.resize(crypto::kSHA256Length, 0); | 47 info->pk_hash.resize(crypto::kSHA256Length, 0); |
| 48 crypto::SHA256HashString(pubkey_bytes, info->pk_hash.data(), | 48 crypto::SHA256HashString(pubkey_bytes, info->pk_hash.data(), |
| 49 info->pk_hash.size()); | 49 info->pk_hash.size()); |
| 50 info->version = *extension->version(); | 50 info->version = *extension->version(); |
| 51 info->allow_background_download = false; | 51 info->allows_background_download = false; |
| 52 | 52 info->requires_network_encryption = true; |
| 53 info->installer = new UpdateInstallShim( | 53 info->installer = new UpdateInstallShim( |
| 54 id, extension->path(), | 54 id, extension->path(), |
| 55 base::Bind(&UpdateDataProvider::RunInstallCallback, this)); | 55 base::Bind(&UpdateDataProvider::RunInstallCallback, this)); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 void UpdateDataProvider::RunInstallCallback(const std::string& extension_id, | 59 void UpdateDataProvider::RunInstallCallback(const std::string& extension_id, |
| 60 const base::FilePath& temp_dir) { | 60 const base::FilePath& temp_dir) { |
| 61 if (!context_) { | 61 if (!context_) { |
| 62 content::BrowserThread::PostBlockingPoolTask( | 62 content::BrowserThread::PostBlockingPoolTask( |
| 63 FROM_HERE, | 63 FROM_HERE, |
| 64 base::Bind(base::IgnoreResult(&base::DeleteFile), temp_dir, false)); | 64 base::Bind(base::IgnoreResult(&base::DeleteFile), temp_dir, false)); |
| 65 return; | 65 return; |
| 66 } else { | 66 } else { |
| 67 callback_.Run(context_, extension_id, temp_dir); | 67 callback_.Run(context_, extension_id, temp_dir); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace extensions | 71 } // namespace extensions |
| OLD | NEW |