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

Side by Side Diff: extensions/common/crx_file.h

Issue 225493002: cleanup: cpplint src/extension/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comment Created 6 years, 8 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
« no previous file with comments | « extensions/browser/view_type_utils.cc ('k') | extensions/common/csp_validator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 EXTENSIONS_COMMON_CRX_FILE_H_ 5 #ifndef EXTENSIONS_COMMON_CRX_FILE_H_
6 #define EXTENSIONS_COMMON_CRX_FILE_H_ 6 #define EXTENSIONS_COMMON_CRX_FILE_H_
7 7
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 11
12 namespace extensions { 12 namespace extensions {
13 13
14 // CRX files have a header that includes a magic key, version number, and 14 // CRX files have a header that includes a magic key, version number, and
15 // some signature sizing information. Use CrxFile object to validate whether 15 // some signature sizing information. Use CrxFile object to validate whether
16 // the header is valid or not. 16 // the header is valid or not.
17 class CrxFile { 17 class CrxFile {
18 public: 18 public:
19
20 // The size of the magic character sequence at the beginning of each crx 19 // The size of the magic character sequence at the beginning of each crx
21 // file, in bytes. This should be a multiple of 4. 20 // file, in bytes. This should be a multiple of 4.
22 static const size_t kCrxFileHeaderMagicSize = 4; 21 static const size_t kCrxFileHeaderMagicSize = 4;
23 22
24 // This header is the first data at the beginning of an extension. Its 23 // This header is the first data at the beginning of an extension. Its
25 // contents are purposely 32-bit aligned so that it can just be slurped into 24 // contents are purposely 32-bit aligned so that it can just be slurped into
26 // a struct without manual parsing. 25 // a struct without manual parsing.
27 struct Header { 26 struct Header {
28 char magic[kCrxFileHeaderMagicSize]; 27 char magic[kCrxFileHeaderMagicSize];
29 uint32 version; 28 uint32 version;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 explicit CrxFile(const Header& header); 70 explicit CrxFile(const Header& header);
72 71
73 // Checks the |header| for validity and returns true if the values are valid. 72 // Checks the |header| for validity and returns true if the values are valid.
74 // If false is returned, more detailed error code is returned in |error|. 73 // If false is returned, more detailed error code is returned in |error|.
75 static bool HeaderIsValid(const Header& header, Error* error); 74 static bool HeaderIsValid(const Header& header, Error* error);
76 }; 75 };
77 76
78 } // namespace extensions 77 } // namespace extensions
79 78
80 #endif // EXTENSIONS_COMMON_CRX_FILE_H_ 79 #endif // EXTENSIONS_COMMON_CRX_FILE_H_
OLDNEW
« no previous file with comments | « extensions/browser/view_type_utils.cc ('k') | extensions/common/csp_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698