Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 10837044: Correct const accessors in base/values.(h|cc), Part II (ListValue) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: David's comments Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 if (((js ? js->GetSize() : 0) + (css ? css->GetSize() : 0)) == 0) { 721 if (((js ? js->GetSize() : 0) + (css ? css->GetSize() : 0)) == 0) {
722 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 722 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
723 errors::kMissingFile, 723 errors::kMissingFile,
724 base::IntToString(definition_index)); 724 base::IntToString(definition_index));
725 return false; 725 return false;
726 } 726 }
727 727
728 if (js) { 728 if (js) {
729 for (size_t script_index = 0; script_index < js->GetSize(); 729 for (size_t script_index = 0; script_index < js->GetSize();
730 ++script_index) { 730 ++script_index) {
731 Value* value; 731 const Value* value;
732 std::string relative; 732 std::string relative;
733 if (!js->Get(script_index, &value) || !value->GetAsString(&relative)) { 733 if (!js->Get(script_index, &value) || !value->GetAsString(&relative)) {
734 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 734 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
735 errors::kInvalidJs, 735 errors::kInvalidJs,
736 base::IntToString(definition_index), 736 base::IntToString(definition_index),
737 base::IntToString(script_index)); 737 base::IntToString(script_index));
738 return false; 738 return false;
739 } 739 }
740 GURL url = GetResourceURL(relative); 740 GURL url = GetResourceURL(relative);
741 ExtensionResource resource = GetResource(relative); 741 ExtensionResource resource = GetResource(relative);
742 result->js_scripts().push_back(UserScript::File( 742 result->js_scripts().push_back(UserScript::File(
743 resource.extension_root(), resource.relative_path(), url)); 743 resource.extension_root(), resource.relative_path(), url));
744 } 744 }
745 } 745 }
746 746
747 if (css) { 747 if (css) {
748 for (size_t script_index = 0; script_index < css->GetSize(); 748 for (size_t script_index = 0; script_index < css->GetSize();
749 ++script_index) { 749 ++script_index) {
750 Value* value; 750 const Value* value;
751 std::string relative; 751 std::string relative;
752 if (!css->Get(script_index, &value) || !value->GetAsString(&relative)) { 752 if (!css->Get(script_index, &value) || !value->GetAsString(&relative)) {
753 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 753 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
754 errors::kInvalidCss, 754 errors::kInvalidCss,
755 base::IntToString(definition_index), 755 base::IntToString(definition_index),
756 base::IntToString(script_index)); 756 base::IntToString(script_index));
757 return false; 757 return false;
758 } 758 }
759 GURL url = GetResourceURL(relative); 759 GURL url = GetResourceURL(relative);
760 ExtensionResource resource = GetResource(relative); 760 ExtensionResource resource = GetResource(relative);
(...skipping 3139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3900 3900
3901 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3901 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3902 const Extension* extension, 3902 const Extension* extension,
3903 const PermissionSet* permissions, 3903 const PermissionSet* permissions,
3904 Reason reason) 3904 Reason reason)
3905 : reason(reason), 3905 : reason(reason),
3906 extension(extension), 3906 extension(extension),
3907 permissions(permissions) {} 3907 permissions(permissions) {}
3908 3908
3909 } // namespace extensions 3909 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api_unittest.cc ('k') | chrome/common/net/gaia/oauth2_mint_token_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698