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/sha2.h" | |
18 #include "base/stl_util-inl.h" | 17 #include "base/stl_util-inl.h" |
19 #include "base/third_party/nss/blapi.h" | |
20 #include "base/string16.h" | 18 #include "base/string16.h" |
21 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
22 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
23 #include "base/values.h" | 21 #include "base/values.h" |
24 #include "base/version.h" | 22 #include "base/version.h" |
| 23 #include "crypto/sha2.h" |
| 24 #include "crypto/third_party/nss/blapi.h" |
25 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/chrome_version_info.h" | 27 #include "chrome/common/chrome_version_info.h" |
28 #include "chrome/common/extensions/extension_action.h" | 28 #include "chrome/common/extensions/extension_action.h" |
29 #include "chrome/common/extensions/extension_constants.h" | 29 #include "chrome/common/extensions/extension_constants.h" |
30 #include "chrome/common/extensions/extension_error_utils.h" | 30 #include "chrome/common/extensions/extension_error_utils.h" |
31 #include "chrome/common/extensions/extension_l10n_util.h" | 31 #include "chrome/common/extensions/extension_l10n_util.h" |
32 #include "chrome/common/extensions/extension_resource.h" | 32 #include "chrome/common/extensions/extension_resource.h" |
33 #include "chrome/common/extensions/extension_sidebar_defaults.h" | 33 #include "chrome/common/extensions/extension_sidebar_defaults.h" |
34 #include "chrome/common/extensions/extension_sidebar_utils.h" | 34 #include "chrome/common/extensions/extension_sidebar_utils.h" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 | 615 |
616 GURL ret_val = GURL(extension_url.spec() + relative_path); | 616 GURL ret_val = GURL(extension_url.spec() + relative_path); |
617 DCHECK(StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); | 617 DCHECK(StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); |
618 | 618 |
619 return ret_val; | 619 return ret_val; |
620 } | 620 } |
621 | 621 |
622 bool Extension::GenerateId(const std::string& input, std::string* output) { | 622 bool Extension::GenerateId(const std::string& input, std::string* output) { |
623 CHECK(output); | 623 CHECK(output); |
624 uint8 hash[Extension::kIdSize]; | 624 uint8 hash[Extension::kIdSize]; |
625 base::SHA256HashString(input, hash, sizeof(hash)); | 625 crypto::SHA256HashString(input, hash, sizeof(hash)); |
626 *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); | 626 *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); |
627 ConvertHexadecimalToIDAlphabet(output); | 627 ConvertHexadecimalToIDAlphabet(output); |
628 | 628 |
629 return true; | 629 return true; |
630 } | 630 } |
631 | 631 |
632 // Helper method that loads a UserScript object from a dictionary in the | 632 // Helper method that loads a UserScript object from a dictionary in the |
633 // content_script list of the manifest. | 633 // content_script list of the manifest. |
634 bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, | 634 bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, |
635 int definition_index, | 635 int definition_index, |
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 | 2719 |
2720 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} | 2720 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} |
2721 | 2721 |
2722 | 2722 |
2723 UnloadedExtensionInfo::UnloadedExtensionInfo( | 2723 UnloadedExtensionInfo::UnloadedExtensionInfo( |
2724 const Extension* extension, | 2724 const Extension* extension, |
2725 Reason reason) | 2725 Reason reason) |
2726 : reason(reason), | 2726 : reason(reason), |
2727 already_disabled(false), | 2727 already_disabled(false), |
2728 extension(extension) {} | 2728 extension(extension) {} |
OLD | NEW |