OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file declares util functions for setup project. | 5 // This file declares util functions for setup project. It also declares a |
6 // few functions that the Chrome component updater uses for patching binary | |
7 // deltas. | |
robertshield
2013/06/17 16:39:28
IMO, there's enough patch-related functionality in
Sorin Jianu
2013/06/17 22:21:09
My expectation is that the patching code will be h
robertshield
2013/06/18 13:27:07
sgtm
| |
6 | 8 |
7 #ifndef CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ | 9 #ifndef CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ |
8 #define CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ | 10 #define CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ |
9 | 11 |
10 #include <windows.h> | 12 #include <windows.h> |
11 | 13 |
12 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
13 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
14 #include "base/win/scoped_handle.h" | 16 #include "base/win/scoped_handle.h" |
15 #include "chrome/installer/util/browser_distribution.h" | 17 #include "chrome/installer/util/browser_distribution.h" |
16 #include "chrome/installer/util/util_constants.h" | 18 #include "chrome/installer/util/util_constants.h" |
17 | 19 |
18 class CommandLine; | 20 class CommandLine; |
19 | 21 |
20 namespace base { | 22 namespace base { |
21 class FilePath; | 23 class FilePath; |
22 class Version; | 24 class Version; |
23 } | 25 } |
24 | 26 |
25 namespace installer { | 27 namespace installer { |
26 | 28 |
27 class InstallationState; | 29 class InstallationState; |
28 class InstallerState; | 30 class InstallerState; |
29 class ProductState; | 31 class ProductState; |
30 | 32 |
31 // Apply a diff patch to source file. First tries to apply it using courgette | 33 // Apply a diff patch to source file. First tries to apply it using Courgette |
32 // since it checks for courgette header and fails quickly. If that fails | 34 // since it checks for Courgette header and fails quickly. If that fails |
33 // tries to apply the patch using regular bsdiff. Returns status code. | 35 // tries to apply the patch using regular bsdiff. Returns status code as |
36 // defined by the bsdiff code (see mbspatch.h for the definitions of the codes). | |
robertshield
2013/06/17 16:39:28
please include the full path to mbspatch.h. It may
Sorin Jianu
2013/06/17 22:21:09
Done.
| |
34 // The installer stage is updated if |installer_state| is non-NULL. | 37 // The installer stage is updated if |installer_state| is non-NULL. |
35 int ApplyDiffPatch(const base::FilePath& src, | 38 int ApplyDiffPatch(const base::FilePath& src, |
36 const base::FilePath& patch, | 39 const base::FilePath& patch, |
37 const base::FilePath& dest, | 40 const base::FilePath& dest, |
38 const InstallerState* installer_state); | 41 const InstallerState* installer_state); |
39 | 42 |
43 // Applies a patch file to source file using Courgette. | |
44 int CourgettePatchFiles(const base::FilePath& src, | |
45 const base::FilePath& patch, | |
46 const base::FilePath& dest); | |
47 | |
48 // Applies a patch file to source file using bsdiff. This function uses | |
49 // Courgette's flavor of bsdiff. | |
50 int BsdiffPatchFiles(const base::FilePath& src, | |
51 const base::FilePath& patch, | |
52 const base::FilePath& dest); | |
53 | |
40 // Find the version of Chrome from an install source directory. | 54 // Find the version of Chrome from an install source directory. |
41 // Chrome_path should contain at least one version folder. | 55 // Chrome_path should contain at least one version folder. |
42 // Returns the maximum version found or NULL if no version is found. | 56 // Returns the maximum version found or NULL if no version is found. |
43 Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path); | 57 Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path); |
44 | 58 |
45 // Spawns a new process that waits for a specified amount of time before | 59 // Spawns a new process that waits for a specified amount of time before |
46 // attempting to delete |path|. This is useful for setup to delete the | 60 // attempting to delete |path|. This is useful for setup to delete the |
47 // currently running executable or a file that we cannot close right away but | 61 // currently running executable or a file that we cannot close right away but |
48 // estimate that it will be possible after some period of time. | 62 // estimate that it will be possible after some period of time. |
49 // Returns true if a new process was started, false otherwise. Note that | 63 // Returns true if a new process was started, false otherwise. Note that |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 // The previous state of the privilege this object is responsible for. As set | 125 // The previous state of the privilege this object is responsible for. As set |
112 // by AdjustTokenPrivileges() upon construction. | 126 // by AdjustTokenPrivileges() upon construction. |
113 TOKEN_PRIVILEGES previous_privileges_; | 127 TOKEN_PRIVILEGES previous_privileges_; |
114 | 128 |
115 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedTokenPrivilege); | 129 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedTokenPrivilege); |
116 }; | 130 }; |
117 | 131 |
118 } // namespace installer | 132 } // namespace installer |
119 | 133 |
120 #endif // CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ | 134 #endif // CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ |
OLD | NEW |