| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Component updates can be either differential updates or full updates. | 5 // Component updates can be either differential updates or full updates. |
| 6 // Full updates come in CRX format; differential updates come in CRX-style | 6 // Full updates come in CRX format; differential updates come in CRX-style |
| 7 // archives, but have a different magic number. They contain "commands.json", a | 7 // archives, but have a different magic number. They contain "commands.json", a |
| 8 // list of commands for the patcher to follow. The patcher uses these commands, | 8 // list of commands for the patcher to follow. The patcher uses these commands, |
| 9 // the other files in the archive, and the files from the existing installation | 9 // the other files in the archive, and the files from the existing installation |
| 10 // of the component to create the contents of a full update, which is then | 10 // of the component to create the contents of a full update, which is then |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // | 22 // |
| 23 // After installation (diff or full), the component updater records "fp", the | 23 // After installation (diff or full), the component updater records "fp", the |
| 24 // fingerprint of the installed files, to later identify the existing files to | 24 // fingerprint of the installed files, to later identify the existing files to |
| 25 // the server so that a proper differential update can be provided next cycle. | 25 // the server so that a proper differential update can be provided next cycle. |
| 26 | 26 |
| 27 | 27 |
| 28 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ | 28 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ |
| 29 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ | 29 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ |
| 30 | 30 |
| 31 #include "base/basictypes.h" | 31 #include "base/basictypes.h" |
| 32 #include "base/callback_forward.h" |
| 32 #include "base/compiler_specific.h" | 33 #include "base/compiler_specific.h" |
| 33 #include "chrome/browser/component_updater/component_unpacker.h" | 34 #include "chrome/browser/component_updater/component_unpacker.h" |
| 34 | 35 |
| 35 namespace base { | 36 namespace base { |
| 36 class FilePath; | 37 class FilePath; |
| 37 } | 38 } |
| 38 | 39 |
| 39 namespace component_updater { | 40 namespace component_updater { |
| 40 | 41 |
| 41 class ComponentInstaller; | 42 class ComponentInstaller; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 70 const base::FilePath& output_file, | 71 const base::FilePath& output_file, |
| 71 int* error) OVERRIDE; | 72 int* error) OVERRIDE; |
| 72 private: | 73 private: |
| 73 DISALLOW_COPY_AND_ASSIGN(ComponentPatcherCrossPlatform); | 74 DISALLOW_COPY_AND_ASSIGN(ComponentPatcherCrossPlatform); |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 // This function takes an unpacked differential CRX (|input_dir|) and a | 77 // This function takes an unpacked differential CRX (|input_dir|) and a |
| 77 // component installer, and creates a new (non-differential) unpacked CRX, which | 78 // component installer, and creates a new (non-differential) unpacked CRX, which |
| 78 // is then installed normally. | 79 // is then installed normally. |
| 79 // The non-differential files are written into the |unpack_dir| directory. | 80 // The non-differential files are written into the |unpack_dir| directory. |
| 80 // Sets |error| to the error code of the first failing patch operation. | 81 // When finished, calls the callback, passing error codes if any errors were |
| 81 ComponentUnpacker::Error DifferentialUpdatePatch( | 82 // encountered. |
| 83 void DifferentialUpdatePatch( |
| 82 const base::FilePath& input_dir, | 84 const base::FilePath& input_dir, |
| 83 const base::FilePath& unpack_dir, | 85 const base::FilePath& unpack_dir, |
| 84 ComponentPatcher* component_patcher, | 86 ComponentPatcher* component_patcher, |
| 85 ComponentInstaller* installer, | 87 ComponentInstaller* installer, |
| 86 int* error); | 88 base::Callback<void(ComponentUnpacker::Error, int)> callback); |
| 87 | 89 |
| 88 } // namespace component_updater | 90 } // namespace component_updater |
| 89 | 91 |
| 90 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ | 92 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_ |
| OLD | NEW |