Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: components/update_client/component_unpacker.cc

Issue 808773005: Move most of the component updater artifacts to update_client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/update_client/component_unpacker.cc
diff --git a/components/component_updater/component_unpacker.cc b/components/update_client/component_unpacker.cc
similarity index 82%
rename from components/component_updater/component_unpacker.cc
rename to components/update_client/component_unpacker.cc
index d904e32623c97ad8aa6de9c5da4303b397606c56..27d75b9f14af689a0eb43df556bc5f4e6c95e0c5 100644
--- a/components/component_updater/component_unpacker.cc
+++ b/components/update_client/component_unpacker.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/component_updater/component_unpacker.h"
+#include "components/update_client/component_unpacker.h"
#include <stdint.h>
#include <string>
@@ -19,18 +19,18 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
-#include "components/component_updater/component_patcher.h"
-#include "components/component_updater/component_patcher_operation.h"
-#include "components/component_updater/component_updater_service.h"
#include "components/crx_file/constants.h"
#include "components/crx_file/crx_file.h"
+#include "components/update_client/component_patcher.h"
+#include "components/update_client/component_patcher_operation.h"
+#include "components/update_client/update_client.h"
#include "crypto/secure_hash.h"
#include "crypto/signature_verifier.h"
#include "third_party/zlib/google/zip.h"
using crypto::SecureHash;
-namespace component_updater {
+namespace update_client {
namespace {
@@ -45,8 +45,7 @@ class CRXValidator {
return;
crx_file::CrxFile::Error error;
- scoped_ptr<crx_file::CrxFile> crx(
- crx_file::CrxFile::Parse(header, &error));
+ scoped_ptr<crx_file::CrxFile> crx(crx_file::CrxFile::Parse(header, &error));
if (!crx.get())
return;
is_delta_ = crx_file::CrxFile::HeaderIsDelta(header);
@@ -63,13 +62,11 @@ class CRXValidator {
return;
crypto::SignatureVerifier verifier;
- if (!verifier.VerifyInit(crx_file::kSignatureAlgorithm,
- base::checked_cast<int>(
- sizeof(crx_file::kSignatureAlgorithm)),
- &signature[0],
- base::checked_cast<int>(signature.size()),
- &key[0],
- base::checked_cast<int>(key.size()))) {
+ if (!verifier.VerifyInit(
+ crx_file::kSignatureAlgorithm,
+ base::checked_cast<int>(sizeof(crx_file::kSignatureAlgorithm)),
+ &signature[0], base::checked_cast<int>(signature.size()), &key[0],
+ base::checked_cast<int>(key.size()))) {
// Signature verification initialization failed. This is most likely
// caused by a public key in the wrong format (should encode algorithm).
return;
@@ -106,14 +103,14 @@ ComponentUnpacker::ComponentUnpacker(
const base::FilePath& path,
const std::string& fingerprint,
ComponentInstaller* installer,
- scoped_refptr<OutOfProcessPatcher> out_of_process_patcher,
+ scoped_refptr<OutOfProcessPatcher> oop_patcher,
scoped_refptr<base::SequencedTaskRunner> task_runner)
: pk_hash_(pk_hash),
path_(path),
is_delta_(false),
fingerprint_(fingerprint),
installer_(installer),
- out_of_process_patcher_(out_of_process_patcher),
+ oop_patcher_(oop_patcher),
error_(kNone),
extended_error_(0),
task_runner_(task_runner) {
@@ -213,23 +210,18 @@ bool ComponentUnpacker::BeginPatching() {
error_ = kUnzipPathError;
return false;
}
- patcher_ = new ComponentPatcher(unpack_diff_path_,
- unpack_path_,
- installer_,
- out_of_process_patcher_,
- task_runner_);
+ patcher_ = new ComponentPatcher(unpack_diff_path_, unpack_path_, installer_,
+ oop_patcher_, task_runner_);
task_runner_->PostTask(
FROM_HERE,
- base::Bind(&ComponentPatcher::Start,
- patcher_,
+ base::Bind(&ComponentPatcher::Start, patcher_,
base::Bind(&ComponentUnpacker::EndPatching,
scoped_refptr<ComponentUnpacker>(this))));
} else {
- task_runner_->PostTask(FROM_HERE,
- base::Bind(&ComponentUnpacker::EndPatching,
- scoped_refptr<ComponentUnpacker>(this),
- kNone,
- 0));
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&ComponentUnpacker::EndPatching,
+ scoped_refptr<ComponentUnpacker>(this), kNone, 0));
}
return true;
}
@@ -257,8 +249,7 @@ void ComponentUnpacker::Install() {
if (static_cast<int>(fingerprint_.size()) !=
base::WriteFile(
unpack_path_.Append(FILE_PATH_LITERAL("manifest.fingerprint")),
- fingerprint_.c_str(),
- base::checked_cast<int>(fingerprint_.size()))) {
+ fingerprint_.c_str(), base::checked_cast<int>(fingerprint_.size()))) {
error_ = kFingerprintWriteFailed;
return;
}
@@ -285,4 +276,4 @@ void ComponentUnpacker::Finish() {
ComponentUnpacker::~ComponentUnpacker() {
}
-} // namespace component_updater
+} // namespace update_client

Powered by Google App Engine
This is Rietveld 408576698