| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 544 |
| 545 GURL ret_val = GURL(extension_url.spec() + relative_path); | 545 GURL ret_val = GURL(extension_url.spec() + relative_path); |
| 546 DCHECK(StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); | 546 DCHECK(StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); |
| 547 | 547 |
| 548 return ret_val; | 548 return ret_val; |
| 549 } | 549 } |
| 550 | 550 |
| 551 bool Extension::GenerateId(const std::string& input, std::string* output) { | 551 bool Extension::GenerateId(const std::string& input, std::string* output) { |
| 552 CHECK(output); | 552 CHECK(output); |
| 553 uint8 hash[Extension::kIdSize]; | 553 uint8 hash[Extension::kIdSize]; |
| 554 base::SHA256HashString(input, hash, sizeof(hash)); | 554 crypto::SHA256HashString(input, hash, sizeof(hash)); |
| 555 *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); | 555 *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); |
| 556 ConvertHexadecimalToIDAlphabet(output); | 556 ConvertHexadecimalToIDAlphabet(output); |
| 557 | 557 |
| 558 return true; | 558 return true; |
| 559 } | 559 } |
| 560 | 560 |
| 561 // Helper method that loads a UserScript object from a dictionary in the | 561 // Helper method that loads a UserScript object from a dictionary in the |
| 562 // content_script list of the manifest. | 562 // content_script list of the manifest. |
| 563 bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, | 563 bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, |
| 564 int definition_index, | 564 int definition_index, |
| (...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2609 | 2609 |
| 2610 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} | 2610 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} |
| 2611 | 2611 |
| 2612 | 2612 |
| 2613 UnloadedExtensionInfo::UnloadedExtensionInfo( | 2613 UnloadedExtensionInfo::UnloadedExtensionInfo( |
| 2614 const Extension* extension, | 2614 const Extension* extension, |
| 2615 Reason reason) | 2615 Reason reason) |
| 2616 : reason(reason), | 2616 : reason(reason), |
| 2617 already_disabled(false), | 2617 already_disabled(false), |
| 2618 extension(extension) {} | 2618 extension(extension) {} |
| OLD | NEW |