OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "extensions/common/id_util.h" | 5 #include "extensions/common/id_util.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "crypto/sha2.h" | 10 #include "crypto/sha2.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return GenerateId(path_bytes); | 53 return GenerateId(path_bytes); |
54 } | 54 } |
55 | 55 |
56 base::FilePath MaybeNormalizePath(const base::FilePath& path) { | 56 base::FilePath MaybeNormalizePath(const base::FilePath& path) { |
57 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
58 // Normalize any drive letter to upper-case. We do this for consistency with | 58 // Normalize any drive letter to upper-case. We do this for consistency with |
59 // net_utils::FilePathToFileURL(), which does the same thing, to make string | 59 // net_utils::FilePathToFileURL(), which does the same thing, to make string |
60 // comparisons simpler. | 60 // comparisons simpler. |
61 base::FilePath::StringType path_str = path.value(); | 61 base::FilePath::StringType path_str = path.value(); |
62 if (path_str.size() >= 2 && path_str[0] >= L'a' && path_str[0] <= L'z' && | 62 if (path_str.size() >= 2 && path_str[0] >= L'a' && path_str[0] <= L'z' && |
63 path_str[1] == ':') | 63 path_str[1] == L':') |
64 path_str[0] += ('A' - 'a'); | 64 path_str[0] = towupper(path_str[0]); |
65 | 65 |
66 return base::FilePath(path_str); | 66 return base::FilePath(path_str); |
67 #else | 67 #else |
68 return path; | 68 return path; |
69 #endif | 69 #endif |
70 } | 70 } |
71 | 71 |
72 } // namespace id_util | 72 } // namespace id_util |
73 } // namespace extensions | 73 } // namespace extensions |
OLD | NEW |