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

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

Issue 9950046: Implement FeatureProvider for ExtensionAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 <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"
(...skipping 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3184 extensions::SimpleFeatureProvider::GetPermissionFeatures(); 3184 extensions::SimpleFeatureProvider::GetPermissionFeatures();
3185 scoped_ptr<extensions::Feature> feature( 3185 scoped_ptr<extensions::Feature> feature(
3186 permission_features->GetFeature(permission->name())); 3186 permission_features->GetFeature(permission->name()));
3187 3187
3188 // The feature should exist since we just got an ExtensionAPIPermission 3188 // The feature should exist since we just got an ExtensionAPIPermission
3189 // for it. The two systems should be updated together whenever a 3189 // for it. The two systems should be updated together whenever a
3190 // permission is added. 3190 // permission is added.
3191 CHECK(feature.get()); 3191 CHECK(feature.get());
3192 3192
3193 extensions::Feature::Availability availability = 3193 extensions::Feature::Availability availability =
3194 feature->IsAvailable(this); 3194 feature->IsAvailableToManifest(
3195 id(),
3196 GetType(),
3197 extensions::Feature::ConvertLocation(location()),
3198 manifest_version());
3195 if (availability != extensions::Feature::IS_AVAILABLE) { 3199 if (availability != extensions::Feature::IS_AVAILABLE) {
3196 // We special case hosted apps because some old versions of Chrome did 3200 // We special case hosted apps because some old versions of Chrome did
3197 // not return errors here and we ended up with extensions in the store 3201 // not return errors here and we ended up with extensions in the store
3198 // containing bad data: crbug.com/101993. 3202 // containing bad data: crbug.com/101993.
3199 if (availability != extensions::Feature::INVALID_TYPE || 3203 if (availability != extensions::Feature::INVALID_TYPE ||
3200 !is_hosted_app()) { 3204 !is_hosted_app()) {
3201 *error = ASCIIToUTF16(feature->GetErrorMessage(availability)); 3205 *error = ASCIIToUTF16(feature->GetErrorMessage(availability));
3202 return false; 3206 return false;
3203 } 3207 }
3204 } 3208 }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
3578 already_disabled(false), 3582 already_disabled(false),
3579 extension(extension) {} 3583 extension(extension) {}
3580 3584
3581 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3585 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3582 const Extension* extension, 3586 const Extension* extension,
3583 const ExtensionPermissionSet* permissions, 3587 const ExtensionPermissionSet* permissions,
3584 Reason reason) 3588 Reason reason)
3585 : reason(reason), 3589 : reason(reason),
3586 extension(extension), 3590 extension(extension),
3587 permissions(permissions) {} 3591 permissions(permissions) {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698