OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/string16.h" | 18 #include "base/string16.h" |
19 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
20 #include "base/string_piece.h" | |
20 #include "base/string_util.h" | 21 #include "base/string_util.h" |
21 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
22 #include "base/values.h" | 23 #include "base/values.h" |
23 #include "base/version.h" | 24 #include "base/version.h" |
24 #include "crypto/sha2.h" | 25 #include "crypto/sha2.h" |
25 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/chrome_version_info.h" | 28 #include "chrome/common/chrome_version_info.h" |
28 #include "chrome/common/extensions/csp_validator.h" | 29 #include "chrome/common/extensions/csp_validator.h" |
29 #include "chrome/common/extensions/extension_action.h" | 30 #include "chrome/common/extensions/extension_action.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 const char kDefaultContentSecurityPolicy[] = | 73 const char kDefaultContentSecurityPolicy[] = |
73 "script-src 'self'; object-src 'self'"; | 74 "script-src 'self'; object-src 'self'"; |
74 | 75 |
75 // Converts a normal hexadecimal string into the alphabet used by extensions. | 76 // Converts a normal hexadecimal string into the alphabet used by extensions. |
76 // We use the characters 'a'-'p' instead of '0'-'f' to avoid ever having a | 77 // We use the characters 'a'-'p' instead of '0'-'f' to avoid ever having a |
77 // completely numeric host, since some software interprets that as an IP | 78 // completely numeric host, since some software interprets that as an IP |
78 // address. | 79 // address. |
79 static void ConvertHexadecimalToIDAlphabet(std::string* id) { | 80 static void ConvertHexadecimalToIDAlphabet(std::string* id) { |
80 for (size_t i = 0; i < id->size(); ++i) { | 81 for (size_t i = 0; i < id->size(); ++i) { |
81 int val; | 82 int val; |
82 if (base::HexStringToInt(id->begin() + i, id->begin() + i + 1, &val)) | 83 if (base::HexStringToInt(base::StringPiece(id->begin() + i, |
84 id->begin() + i + 1), | |
85 &val)) | |
erikwright (departed)
2011/12/14 04:24:08
need {} around if and else blocks when condition w
| |
83 (*id)[i] = val + 'a'; | 86 (*id)[i] = val + 'a'; |
84 else | 87 else |
85 (*id)[i] = 'a'; | 88 (*id)[i] = 'a'; |
86 } | 89 } |
87 } | 90 } |
88 | 91 |
89 // A singleton object containing global data needed by the extension objects. | 92 // A singleton object containing global data needed by the extension objects. |
90 class ExtensionConfig { | 93 class ExtensionConfig { |
91 public: | 94 public: |
92 static ExtensionConfig* GetInstance() { | 95 static ExtensionConfig* GetInstance() { |
(...skipping 2888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2981 already_disabled(false), | 2984 already_disabled(false), |
2982 extension(extension) {} | 2985 extension(extension) {} |
2983 | 2986 |
2984 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 2987 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
2985 const Extension* extension, | 2988 const Extension* extension, |
2986 const ExtensionPermissionSet* permissions, | 2989 const ExtensionPermissionSet* permissions, |
2987 Reason reason) | 2990 Reason reason) |
2988 : reason(reason), | 2991 : reason(reason), |
2989 extension(extension), | 2992 extension(extension), |
2990 permissions(permissions) {} | 2993 permissions(permissions) {} |
OLD | NEW |