Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: chrome/browser/component_updater/component_unpacker.h

Issue 15908002: Differential updates for components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: really removing the lzma files this time. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_ 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_ 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_
7 7
8 #include <string>
8 #include <vector> 9 #include <vector>
9 10 #include "base/basictypes.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 12
12 class ComponentInstaller; 13 class ComponentInstaller;
14 class ComponentPatcher;
13 15
14 // In charge of unpacking the component CRX package and verifying that it is 16 // In charge of unpacking the component CRX package and verifying that it is
15 // well formed and the cryptographic signature is correct. If there is no 17 // well formed and the cryptographic signature is correct. If there is no
16 // error the component specific installer will be invoked to proceed with 18 // error the component specific installer will be invoked to proceed with
17 // the component installation or update. 19 // the component installation or update.
18 // 20 //
19 // This class should be used only by the component updater. It is inspired 21 // This class should be used only by the component updater. It is inspired
20 // and overlaps with code in the extension's SandboxedUnpacker. 22 // and overlaps with code in the extension's SandboxedUnpacker.
21 // The main differences are: 23 // The main differences are:
22 // - The public key hash is full SHA256. 24 // - The public key hash is full SHA256.
23 // - Does not use a sandboxed unpacker. A valid component is fully trusted. 25 // - Does not use a sandboxed unpacker. A valid component is fully trusted.
24 // - The manifest can have different attributes and resources are not 26 // - The manifest can have different attributes and resources are not
25 // transcoded. 27 // transcoded.
26 class ComponentUnpacker { 28 class ComponentUnpacker {
27 public: 29 public:
28 // Possible error conditions. 30 // Possible error conditions.
31 // Add only to the bottom of this enum; the order must be kept stable.
29 enum Error { 32 enum Error {
30 kNone, 33 kNone,
31 kInvalidParams, 34 kInvalidParams,
32 kInvalidFile, 35 kInvalidFile,
33 kUzipPathError, 36 kUnzipPathError,
34 kUnzipFailed, 37 kUnzipFailed,
35 kNoManifest, 38 kNoManifest,
36 kBadManifest, 39 kBadManifest,
37 kBadExtension, 40 kBadExtension,
38 kInvalidId, 41 kInvalidId,
39 kInstallerError, 42 kInstallerError,
43 kIoError,
44 kDeltaVerificationFailure,
45 kDeltaBadCommands,
46 kDeltaUnsupportedCommand,
47 kDeltaOperationFailure,
48 kDeltaPatchProcessFailure,
49 kDeltaMissingExistingFile,
50 kFingerprintWriteFailed,
40 }; 51 };
41 // Unpacks, verifies and calls the installer. |pk_hash| is the expected 52 // Unpacks, verifies and calls the installer. |pk_hash| is the expected
42 // public key SHA256 hash. |path| is the current location of the CRX. 53 // public key SHA256 hash. |path| is the current location of the CRX.
43 ComponentUnpacker(const std::vector<uint8>& pk_hash, 54 ComponentUnpacker(const std::vector<uint8>& pk_hash,
44 const base::FilePath& path, 55 const base::FilePath& path,
56 const std::string& fingerprint,
57 ComponentPatcher* patcher,
45 ComponentInstaller* installer); 58 ComponentInstaller* installer);
46 59
47 // If something went wrong during unpacking or installer invocation, the 60 // If something went wrong during unpacking or installer invocation, the
48 // destructor will delete the unpacked CRX files. 61 // destructor will delete the unpacked CRX files.
49 ~ComponentUnpacker(); 62 ~ComponentUnpacker();
50 63
51 Error error() const { return error_; } 64 Error error() const { return error_; }
52 65
66 int extended_error() const { return extended_error_; }
67
53 private: 68 private:
54 base::FilePath unpack_path_; 69 base::FilePath unpack_path_;
55 Error error_; 70 Error error_;
71 int extended_error_; // Provides additional error information.
56 }; 72 };
robertshield 2013/06/17 17:47:00 nit: two spaces before comment
Sorin Jianu 2013/06/17 22:21:09 Done.
57 73
58 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_ 74 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698