OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 if (((js ? js->GetSize() : 0) + (css ? css->GetSize() : 0)) == 0) { | 719 if (((js ? js->GetSize() : 0) + (css ? css->GetSize() : 0)) == 0) { |
720 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 720 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
721 errors::kMissingFile, | 721 errors::kMissingFile, |
722 base::IntToString(definition_index)); | 722 base::IntToString(definition_index)); |
723 return false; | 723 return false; |
724 } | 724 } |
725 | 725 |
726 if (js) { | 726 if (js) { |
727 for (size_t script_index = 0; script_index < js->GetSize(); | 727 for (size_t script_index = 0; script_index < js->GetSize(); |
728 ++script_index) { | 728 ++script_index) { |
729 Value* value; | 729 const Value* value; |
730 std::string relative; | 730 std::string relative; |
731 if (!js->Get(script_index, &value) || !value->GetAsString(&relative)) { | 731 if (!js->Get(script_index, &value) || !value->GetAsString(&relative)) { |
732 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 732 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
733 errors::kInvalidJs, | 733 errors::kInvalidJs, |
734 base::IntToString(definition_index), | 734 base::IntToString(definition_index), |
735 base::IntToString(script_index)); | 735 base::IntToString(script_index)); |
736 return false; | 736 return false; |
737 } | 737 } |
738 GURL url = GetResourceURL(relative); | 738 GURL url = GetResourceURL(relative); |
739 ExtensionResource resource = GetResource(relative); | 739 ExtensionResource resource = GetResource(relative); |
740 result->js_scripts().push_back(UserScript::File( | 740 result->js_scripts().push_back(UserScript::File( |
741 resource.extension_root(), resource.relative_path(), url)); | 741 resource.extension_root(), resource.relative_path(), url)); |
742 } | 742 } |
743 } | 743 } |
744 | 744 |
745 if (css) { | 745 if (css) { |
746 for (size_t script_index = 0; script_index < css->GetSize(); | 746 for (size_t script_index = 0; script_index < css->GetSize(); |
747 ++script_index) { | 747 ++script_index) { |
748 Value* value; | 748 const Value* value; |
749 std::string relative; | 749 std::string relative; |
750 if (!css->Get(script_index, &value) || !value->GetAsString(&relative)) { | 750 if (!css->Get(script_index, &value) || !value->GetAsString(&relative)) { |
751 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 751 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
752 errors::kInvalidCss, | 752 errors::kInvalidCss, |
753 base::IntToString(definition_index), | 753 base::IntToString(definition_index), |
754 base::IntToString(script_index)); | 754 base::IntToString(script_index)); |
755 return false; | 755 return false; |
756 } | 756 } |
757 GURL url = GetResourceURL(relative); | 757 GURL url = GetResourceURL(relative); |
758 ExtensionResource resource = GetResource(relative); | 758 ExtensionResource resource = GetResource(relative); |
(...skipping 3125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3884 | 3884 |
3885 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3885 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
3886 const Extension* extension, | 3886 const Extension* extension, |
3887 const PermissionSet* permissions, | 3887 const PermissionSet* permissions, |
3888 Reason reason) | 3888 Reason reason) |
3889 : reason(reason), | 3889 : reason(reason), |
3890 extension(extension), | 3890 extension(extension), |
3891 permissions(permissions) {} | 3891 permissions(permissions) {} |
3892 | 3892 |
3893 } // namespace extensions | 3893 } // namespace extensions |
OLD | NEW |