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

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

Issue 10349015: Make platform apps get isolated storage by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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 "base/base64.h" 7 #include "base/base64.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 } else if (manifest_version_ >= 2) { 2686 } else if (manifest_version_ >= 2) {
2687 // Manifest version 2 introduced a default Content-Security-Policy. 2687 // Manifest version 2 introduced a default Content-Security-Policy.
2688 // TODO(abarth): Should we continue to let extensions override the 2688 // TODO(abarth): Should we continue to let extensions override the
2689 // default Content-Security-Policy? 2689 // default Content-Security-Policy?
2690 content_security_policy_ = kDefaultContentSecurityPolicy; 2690 content_security_policy_ = kDefaultContentSecurityPolicy;
2691 CHECK(ContentSecurityPolicyIsSecure(content_security_policy_)); 2691 CHECK(ContentSecurityPolicyIsSecure(content_security_policy_));
2692 } 2692 }
2693 return true; 2693 return true;
2694 } 2694 }
2695 2695
2696 bool Extension::LoadAppIsolation(string16* error) { 2696 bool Extension::LoadAppIsolation(
2697 const ExtensionAPIPermissionSet& api_permissions, string16* error) {
2698 // Platform apps always get isolated storage.
2699 if (is_platform_app()) {
2700 is_storage_isolated_ = true;
2701 return true;
2702 }
2703
2704 // Other apps only get it if it is requested _and_ experimental APIs are
2705 // enabled.
2706 if (!api_permissions.count(ExtensionAPIPermission::kExperimental) ||
2707 !is_app()) {
2708 return true;
2709 }
2710
2697 Value* temp = NULL; 2711 Value* temp = NULL;
2698 if (!manifest_->Get(keys::kIsolation, &temp)) 2712 if (!manifest_->Get(keys::kIsolation, &temp))
2699 return true; 2713 return true;
2700 2714
2701 if (temp->GetType() != Value::TYPE_LIST) { 2715 if (temp->GetType() != Value::TYPE_LIST) {
2702 *error = ASCIIToUTF16(errors::kInvalidIsolation); 2716 *error = ASCIIToUTF16(errors::kInvalidIsolation);
2703 return false; 2717 return false;
2704 } 2718 }
2705 2719
2706 ListValue* isolation_list = static_cast<ListValue*>(temp); 2720 ListValue* isolation_list = static_cast<ListValue*>(temp);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3073 3087
3074 ExtensionAPIPermissionSet optional_api_permissions; 3088 ExtensionAPIPermissionSet optional_api_permissions;
3075 URLPatternSet optional_host_permissions; 3089 URLPatternSet optional_host_permissions;
3076 if (!ParsePermissions(keys::kOptionalPermissions, 3090 if (!ParsePermissions(keys::kOptionalPermissions,
3077 error, 3091 error,
3078 &optional_api_permissions, 3092 &optional_api_permissions,
3079 &optional_host_permissions)) { 3093 &optional_host_permissions)) {
3080 return false; 3094 return false;
3081 } 3095 }
3082 3096
3083 // App isolation. 3097 if (!LoadAppIsolation(api_permissions, error))
3084 if (api_permissions.count(ExtensionAPIPermission::kExperimental) &&
3085 is_app() && !LoadAppIsolation(error))
3086 return false; 3098 return false;
3087 3099
3088 if (!LoadSharedFeatures(api_permissions, error)) 3100 if (!LoadSharedFeatures(api_permissions, error))
3089 return false; 3101 return false;
3090 3102
3091 if (!LoadExtensionFeatures(api_permissions, error)) 3103 if (!LoadExtensionFeatures(api_permissions, error))
3092 return false; 3104 return false;
3093 3105
3094 if (!LoadThemeFeatures(error)) 3106 if (!LoadThemeFeatures(error))
3095 return false; 3107 return false;
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
3715 already_disabled(false), 3727 already_disabled(false),
3716 extension(extension) {} 3728 extension(extension) {}
3717 3729
3718 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3730 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3719 const Extension* extension, 3731 const Extension* extension,
3720 const ExtensionPermissionSet* permissions, 3732 const ExtensionPermissionSet* permissions,
3721 Reason reason) 3733 Reason reason)
3722 : reason(reason), 3734 : reason(reason),
3723 extension(extension), 3735 extension(extension),
3724 permissions(permissions) {} 3736 permissions(permissions) {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698