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

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

Issue 10689097: Enforce the 'requirements' field in manifests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 } else { 1670 } else {
1671 sandboxed_pages_content_security_policy_ = 1671 sandboxed_pages_content_security_policy_ =
1672 kDefaultSandboxedPageContentSecurityPolicy; 1672 kDefaultSandboxedPageContentSecurityPolicy;
1673 CHECK(ContentSecurityPolicyIsSandboxed( 1673 CHECK(ContentSecurityPolicyIsSandboxed(
1674 sandboxed_pages_content_security_policy_, GetType())); 1674 sandboxed_pages_content_security_policy_, GetType()));
1675 } 1675 }
1676 1676
1677 return true; 1677 return true;
1678 } 1678 }
1679 1679
1680 // These are not actually persisted (they're only used by the store), but
1681 // still validated.
1682 bool Extension::CheckRequirements(string16* error) { 1680 bool Extension::CheckRequirements(string16* error) {
1683 if (!manifest_->HasKey(keys::kRequirements)) 1681 if (!manifest_->HasKey(keys::kRequirements))
1684 return true; 1682 return true;
1685 DictionaryValue* requirements_value = NULL; 1683 DictionaryValue* requirements_value = NULL;
1686 if (!manifest_->GetDictionary(keys::kRequirements, &requirements_value)) { 1684 if (!manifest_->GetDictionary(keys::kRequirements, &requirements_value)) {
1687 *error = ASCIIToUTF16(errors::kInvalidRequirements); 1685 *error = ASCIIToUTF16(errors::kInvalidRequirements);
1688 return false; 1686 return false;
1689 } 1687 }
1690 1688
1691 for (DictionaryValue::key_iterator it = requirements_value->begin_keys(); 1689 for (DictionaryValue::key_iterator it = requirements_value->begin_keys();
(...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3884 3882
3885 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3883 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3886 const Extension* extension, 3884 const Extension* extension,
3887 const PermissionSet* permissions, 3885 const PermissionSet* permissions,
3888 Reason reason) 3886 Reason reason)
3889 : reason(reason), 3887 : reason(reason),
3890 extension(extension), 3888 extension(extension),
3891 permissions(permissions) {} 3889 permissions(permissions) {}
3892 3890
3893 } // namespace extensions 3891 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698