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

Unified Diff: chrome/browser/extensions/crx_file.h

Issue 12578008: Move CrxFile, FileReader, ExtensionResource to src/extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/convert_web_app_unittest.cc ('k') | chrome/browser/extensions/crx_file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/crx_file.h
diff --git a/chrome/browser/extensions/crx_file.h b/chrome/browser/extensions/crx_file.h
deleted file mode 100644
index 2faa8ee9cffc31cc5ce9e780b3b8adc3e9c81bc5..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/crx_file.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_EXTENSIONS_CRX_FILE_H_
-#define CHROME_BROWSER_EXTENSIONS_CRX_FILE_H_
-
-#include <sys/types.h>
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-
-namespace extensions {
-
-// CRX files have a header that includes a magic key, version number, and
-// some signature sizing information. Use CrxFile object to validate whether
-// the header is valid or not.
-class CrxFile {
- public:
-
- // The size of the magic character sequence at the beginning of each crx
- // file, in bytes. This should be a multiple of 4.
- static const size_t kCrxFileHeaderMagicSize = 4;
-
- // This header is the first data at the beginning of an extension. Its
- // contents are purposely 32-bit aligned so that it can just be slurped into
- // a struct without manual parsing.
- struct Header {
- char magic[kCrxFileHeaderMagicSize];
- uint32 version;
- uint32 key_size; // The size of the public key, in bytes.
- uint32 signature_size; // The size of the signature, in bytes.
- // An ASN.1-encoded PublicKeyInfo structure follows.
- // The signature follows.
- };
-
- enum Error {
- kWrongMagic,
- kInvalidVersion,
- kInvalidKeyTooLarge,
- kInvalidKeyTooSmall,
- kInvalidSignatureTooLarge,
- kInvalidSignatureTooSmall,
- };
-
- // Construct a new CRX file header object with bytes of a header
- // read from a CRX file. If a null scoped_ptr is returned, |error|
- // contains an error code with additional information.
- static scoped_ptr<CrxFile> Parse(const Header& header, Error* error);
-
- // Construct a new header for the given key and signature sizes.
- // Returns a null scoped_ptr if erroneous values of |key_size| and/or
- // |signature_size| are provided. |error| contains an error code with
- // additional information.
- // Use this constructor and then .header() to obtain the Header
- // for writing out to a CRX file.
- static scoped_ptr<CrxFile> Create(const uint32 key_size,
- const uint32 signature_size,
- Error* error);
-
- // Returns the header structure for writing out to a CRX file.
- const Header& header() const { return header_; }
-
- private:
- Header header_;
-
- // Constructor is private. Clients should use static factory methods above.
- explicit CrxFile(const Header& header);
-
- // Checks the |header| for validity and returns true if the values are valid.
- // If false is returned, more detailed error code is returned in |error|.
- static bool HeaderIsValid(const Header& header, Error* error);
-};
-
-} // namespace extensions
-
-#endif // CHROME_BROWSER_EXTENSIONS_CRX_FILE_H_
« no previous file with comments | « chrome/browser/extensions/convert_web_app_unittest.cc ('k') | chrome/browser/extensions/crx_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698