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/files/file_path.h" | |
|
cpu_(ooo_6.6-7.5)
2013/05/29 20:06:44
I am guessing you can forward declare FilePath her
waffles
2013/06/13 20:55:04
Done.
| |
| 10 | |
| 11 class ComponentInstaller; | |
| 12 | |
| 13 enum DeltaUpdateResult { | |
|
cpu_(ooo_6.6-7.5)
2013/05/29 20:06:44
while the all caps constants in enums is a valid s
waffles
2013/06/13 20:55:04
Done. We've unified this with the unpacker error c
| |
| 14 // Indicates success. | |
| 15 DELTA_OK, | |
| 16 | |
| 17 // Either the file doesn't exist or the expected hash is invalid. | |
| 18 DELTA_VERIFICATION_INPUT_ERROR, | |
| 19 | |
| 20 // The expected hash and the actual hash don't match. | |
| 21 DELTA_VERIFICATION_FAILURE, | |
| 22 | |
| 23 // commands.json is malformed, or references files that don't exist. | |
| 24 DELTA_BAD_COMMANDS, | |
| 25 | |
| 26 // commands.json contains an unsupported command. | |
| 27 DELTA_UNSUPPORTED_COMMAND, | |
| 28 | |
| 29 // There was a generic I/O error. | |
| 30 DELTA_IO_ERROR, | |
| 31 | |
| 32 // The operation (courgette/bsdiff/move/...) failed. | |
| 33 DELTA_OPERATION_FAILURE, | |
| 34 | |
| 35 // The process which runs Courgette failed to start or the exit code of | |
| 36 // the process could not be retrieved. | |
| 37 DELTA_PATCH_PROCESS_FAILURE, | |
| 38 }; | |
| 39 | |
| 40 // The type of a patch file. | |
| 41 enum PatchType { | |
| 42 PATCH_TYPE_UNKNOWN, | |
| 43 PATCH_TYPE_COURGETTE, | |
| 44 PATCH_TYPE_BSDIFF, | |
| 45 }; | |
| 46 | |
| 47 // Applies a delta patch to a file. | |
|
cpu_(ooo_6.6-7.5)
2013/05/29 20:06:44
we can beef a bit this description, like explainin
waffles
2013/06/13 20:55:04
Done.
| |
| 48 class ComponentPatcher { | |
| 49 public: | |
| 50 ComponentPatcher() {} | |
| 51 virtual DeltaUpdateResult Patch(PatchType patch_type, | |
| 52 const base::FilePath& input_file, | |
| 53 const base::FilePath& patch_file, | |
| 54 const base::FilePath& output_file, | |
| 55 int* error) = 0; | |
| 56 virtual ~ComponentPatcher() {} | |
| 57 | |
| 58 private: | |
| 59 DISALLOW_COPY_AND_ASSIGN(ComponentPatcher); | |
|
cpu_(ooo_6.6-7.5)
2013/05/29 20:06:44
abstract base classes we normally don't put DISALL
waffles
2013/06/13 20:55:04
Done.
| |
| 60 }; | |
| 61 | |
| 62 class ComponentPatcherCrossPlatform : public ComponentPatcher { | |
| 63 public: | |
| 64 ComponentPatcherCrossPlatform(); | |
| 65 virtual DeltaUpdateResult Patch(PatchType patch_type, | |
| 66 const base::FilePath& input_file, | |
| 67 const base::FilePath& patch_file, | |
| 68 const base::FilePath& output_file, | |
| 69 int* error) OVERRIDE; | |
|
cpu_(ooo_6.6-7.5)
2013/05/29 20:06:44
use of override macro might require the compiler_s
waffles
2013/06/13 20:55:04
Done.
| |
| 70 private: | |
| 71 DISALLOW_COPY_AND_ASSIGN(ComponentPatcherCrossPlatform); | |
| 72 }; | |
| 73 | |
| 74 // Recreates the content of a full CRX by taking the unpacked files of a | |
| 75 // differential component update in |input_dir| and patching the installed | |
| 76 // component files. | |
| 77 // The resulting files are written into the |unpack_dir| directory. | |
| 78 DeltaUpdateResult DifferentialUpdatePatch(const base::FilePath& input_dir, | |
| 79 const base::FilePath& unpack_dir, | |
| 80 ComponentPatcher* component_patcher, | |
| 81 ComponentInstaller* installer, | |
| 82 int* error); | |
| 83 | |
| 84 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ | |
| OLD | NEW |