Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ | |
| 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "chrome/browser/component_updater/component_unpacker.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class FilePath; | |
| 14 } | |
| 15 | |
| 16 class ComponentInstaller; | |
| 17 | |
| 18 // The type of a patch file. | |
| 19 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
| |
| 20 kPatchTypeUnknown, | |
| 21 kPatchTypeCourgette, | |
| 22 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
| |
| 23 }; | |
| 24 | |
| 25 // 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
| |
| 26 // |output_file| using |input_file| patched according to the algorithm | |
| 27 // specified by |patch_type| using |patch_file|. Sets the value of error to | |
| 28 // the error code of the failing patch operation, if there is such a failure. | |
| 29 class ComponentPatcher { | |
| 30 public: | |
| 31 ComponentPatcher() {} | |
| 32 virtual ComponentUnpacker::Error Patch(PatchType patch_type, | |
| 33 const base::FilePath& input_file, | |
| 34 const base::FilePath& patch_file, | |
| 35 const base::FilePath& output_file, | |
| 36 int* error) = 0; | |
| 37 virtual ~ComponentPatcher() {} | |
| 38 }; | |
| 39 | |
| 40 class ComponentPatcherCrossPlatform : public ComponentPatcher { | |
| 41 public: | |
| 42 ComponentPatcherCrossPlatform(); | |
| 43 virtual ComponentUnpacker::Error Patch(PatchType patch_type, | |
| 44 const base::FilePath& input_file, | |
| 45 const base::FilePath& patch_file, | |
| 46 const base::FilePath& output_file, | |
| 47 int* error) OVERRIDE; | |
| 48 private: | |
| 49 DISALLOW_COPY_AND_ASSIGN(ComponentPatcherCrossPlatform); | |
| 50 }; | |
| 51 | |
| 52 // Recreates the content of a full CRX by taking the unpacked files of a | |
| 53 // differential component update in |input_dir| and patching the installed | |
| 54 // component files. | |
| 55 // The resulting files are written into the |unpack_dir| directory. | |
| 56 ComponentUnpacker::Error DifferentialUpdatePatch( | |
| 57 const base::FilePath& input_dir, | |
| 58 const base::FilePath& unpack_dir, | |
| 59 ComponentPatcher* component_patcher, | |
| 60 ComponentInstaller* installer, | |
| 61 int* error); | |
| 62 | |
| 63 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ | |
| OLD | NEW |