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. | |
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 third_party/bspatch/mbspatch.h for the | |
37 // definitions of the codes). | |
34 // The installer stage is updated if |installer_state| is non-NULL. | 38 // The installer stage is updated if |installer_state| is non-NULL. |
35 int ApplyDiffPatch(const base::FilePath& src, | 39 int ApplyDiffPatch(const base::FilePath& src, |
36 const base::FilePath& patch, | 40 const base::FilePath& patch, |
37 const base::FilePath& dest, | 41 const base::FilePath& dest, |
38 const InstallerState* installer_state); | 42 const InstallerState* installer_state); |
39 | 43 |
44 // Applies a patch file to source file using Courgette. | |
grt (UTC plus 2)
2013/06/19 14:45:36
please document return value.
Sorin Jianu
2013/06/19 17:14:45
Done.
| |
45 int CourgettePatchFiles(const base::FilePath& src, | |
46 const base::FilePath& patch, | |
47 const base::FilePath& dest); | |
48 | |
49 // Applies a patch file to source file using bsdiff. This function uses | |
50 // Courgette's flavor of bsdiff. | |
grt (UTC plus 2)
2013/06/19 14:45:36
please document return value.
Sorin Jianu
2013/06/19 17:14:45
Done.
| |
51 int BsdiffPatchFiles(const base::FilePath& src, | |
52 const base::FilePath& patch, | |
53 const base::FilePath& dest); | |
54 | |
40 // Find the version of Chrome from an install source directory. | 55 // Find the version of Chrome from an install source directory. |
41 // Chrome_path should contain at least one version folder. | 56 // Chrome_path should contain at least one version folder. |
42 // Returns the maximum version found or NULL if no version is found. | 57 // Returns the maximum version found or NULL if no version is found. |
43 Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path); | 58 Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path); |
44 | 59 |
45 // Spawns a new process that waits for a specified amount of time before | 60 // 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 | 61 // 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 | 62 // 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. | 63 // estimate that it will be possible after some period of time. |
49 // Returns true if a new process was started, false otherwise. Note that | 64 // 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 | 126 // The previous state of the privilege this object is responsible for. As set |
112 // by AdjustTokenPrivileges() upon construction. | 127 // by AdjustTokenPrivileges() upon construction. |
113 TOKEN_PRIVILEGES previous_privileges_; | 128 TOKEN_PRIVILEGES previous_privileges_; |
114 | 129 |
115 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedTokenPrivilege); | 130 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedTokenPrivilege); |
116 }; | 131 }; |
117 | 132 |
118 } // namespace installer | 133 } // namespace installer |
119 | 134 |
120 #endif // CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ | 135 #endif // CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ |
OLD | NEW |