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

Unified Diff: chrome/browser/component_updater/component_patcher.h

Issue 15908002: Differential updates for components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: really removing the lzma files this time. Created 7 years, 6 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: 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..89fa70a6a3953e50cdb15723422daeb25bda9fa0
--- /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;
+
+// The type of a patch file.
+enum PatchType {
erikwright (departed) 2013/06/17 17:24:28 This enum in the global namespace seems dangerous
Sorin Jianu 2013/06/17 22:21:09 Done. We will introduce a namespace in a future CL
+ kPatchTypeUnknown,
+ kPatchTypeCourgette,
+ kPatchTypeBsdiff,
sra1 2013/06/15 00:56:17 One thing to consider: Since Courgette ends with
waffles 2013/06/17 23:51:07 That makes sense; but I think we prefer to keep it
+};
+
+// Applies a delta patch to a file. Specifically, creates a file at
robertshield 2013/06/17 17:47:00 From reading the implementation, it looks like a d
waffles 2013/06/17 23:51:07 Done; the comment for DifferentialUpdatePatch has
+// |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:
+ 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_

Powered by Google App Engine
This is Rietveld 408576698