| Index: chrome/browser/component_updater/component_patcher.h
|
| diff --git a/chrome/browser/component_updater/component_patcher.h b/chrome/browser/component_updater/component_patcher.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..70171154bfdde24668e281f783bc54c63899616a
|
| --- /dev/null
|
| +++ b/chrome/browser/component_updater/component_patcher.h
|
| @@ -0,0 +1,63 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_
|
| +#define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/compiler_specific.h"
|
| +#include "chrome/browser/component_updater/component_unpacker.h"
|
| +
|
| +namespace base {
|
| +class FilePath;
|
| +}
|
| +
|
| +class ComponentInstaller;
|
| +
|
| +// Applies a delta patch to a file. Specifically, creates a file at
|
| +// |output_file| using |input_file| patched according to the algorithm
|
| +// specified by |patch_type| using |patch_file|. Sets the value of error to
|
| +// the error code of the failing patch operation, if there is such a failure.
|
| +class ComponentPatcher {
|
| + public:
|
| + // The type of a patch file.
|
| + enum PatchType {
|
| + kPatchTypeUnknown,
|
| + kPatchTypeCourgette,
|
| + kPatchTypeBsdiff,
|
| + };
|
| +
|
| + ComponentPatcher() {}
|
| + virtual ComponentUnpacker::Error Patch(PatchType patch_type,
|
| + const base::FilePath& input_file,
|
| + const base::FilePath& patch_file,
|
| + const base::FilePath& output_file,
|
| + int* error) = 0;
|
| + virtual ~ComponentPatcher() {}
|
| +};
|
| +
|
| +class ComponentPatcherCrossPlatform : public ComponentPatcher {
|
| + public:
|
| + ComponentPatcherCrossPlatform();
|
| + virtual ComponentUnpacker::Error Patch(PatchType patch_type,
|
| + const base::FilePath& input_file,
|
| + const base::FilePath& patch_file,
|
| + const base::FilePath& output_file,
|
| + int* error) OVERRIDE;
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(ComponentPatcherCrossPlatform);
|
| +};
|
| +
|
| +// Recreates the content of a full CRX by taking the unpacked files of a
|
| +// differential component update in |input_dir| and patching the installed
|
| +// component files.
|
| +// The resulting files are written into the |unpack_dir| directory.
|
| +ComponentUnpacker::Error DifferentialUpdatePatch(
|
| + const base::FilePath& input_dir,
|
| + const base::FilePath& unpack_dir,
|
| + ComponentPatcher* component_patcher,
|
| + ComponentInstaller* installer,
|
| + int* error);
|
| +
|
| +#endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_
|
|
|