Clean up extension confirmation prompts and make them consistent between Views and...
[chromium-blink-merge.git] / components / crx_file / id_util.h
blobbd11d96db31bf643d95024c86781c18d78e67e37
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_CRX_FILE_ID_UTIL_H_
6 #define COMPONENTS_CRX_FILE_ID_UTIL_H_
8 #include <string>
10 namespace base {
11 class FilePath;
14 namespace crx_file {
15 namespace id_util {
17 // The number of bytes in a legal id.
18 extern const size_t kIdSize;
20 // Generates an extension ID from arbitrary input. The same input string will
21 // always generate the same output ID.
22 std::string GenerateId(const std::string& input);
24 // Generates an ID for an extension in the given path.
25 // Used while developing extensions, before they have a key.
26 std::string GenerateIdForPath(const base::FilePath& path);
28 // Returns the hash of an extension ID in hex.
29 std::string HashedIdInHex(const std::string& id);
31 // Normalizes the path for use by the extension. On Windows, this will make
32 // sure the drive letter is uppercase.
33 base::FilePath MaybeNormalizePath(const base::FilePath& path);
35 // Checks if |id| is a valid extension-id. Extension-ids are used for anything
36 // that comes in a CRX file, including apps, extensions, and components.
37 bool IdIsValid(const std::string& id);
39 } // namespace id_util
40 } // namespace crx_file
42 #endif // COMPONENTS_CRX_FILE_ID_UTIL_H_