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

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: hate hate hate 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 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 extensions::SimpleFeatureProvider::GetPermissionFeatures(); 3307 extensions::SimpleFeatureProvider::GetPermissionFeatures();
3308 scoped_ptr<extensions::Feature> feature( 3308 scoped_ptr<extensions::Feature> feature(
3309 permission_features->GetFeature(permission->name())); 3309 permission_features->GetFeature(permission->name()));
3310 3310
3311 // The feature should exist since we just got an ExtensionAPIPermission 3311 // The feature should exist since we just got an ExtensionAPIPermission
3312 // for it. The two systems should be updated together whenever a 3312 // for it. The two systems should be updated together whenever a
3313 // permission is added. 3313 // permission is added.
3314 CHECK(feature.get()); 3314 CHECK(feature.get());
3315 3315
3316 extensions::Feature::Availability availability = 3316 extensions::Feature::Availability availability =
3317 feature->IsAvailable(this); 3317 feature->IsAvailableToManifest(
3318 id(),
3319 GetType(),
3320 extensions::Feature::ConvertLocation(location()),
3321 manifest_version());
3318 if (availability != extensions::Feature::IS_AVAILABLE) { 3322 if (availability != extensions::Feature::IS_AVAILABLE) {
3319 // We special case hosted apps because some old versions of Chrome did 3323 // We special case hosted apps because some old versions of Chrome did
3320 // not return errors here and we ended up with extensions in the store 3324 // not return errors here and we ended up with extensions in the store
3321 // containing bad data: crbug.com/101993. 3325 // containing bad data: crbug.com/101993.
3322 if (availability != extensions::Feature::INVALID_TYPE || 3326 if (availability != extensions::Feature::INVALID_TYPE ||
3323 !is_hosted_app()) { 3327 !is_hosted_app()) {
3324 *error = ASCIIToUTF16(feature->GetErrorMessage(availability)); 3328 *error = ASCIIToUTF16(feature->GetErrorMessage(availability));
3325 return false; 3329 return false;
3326 } 3330 }
3327 } 3331 }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 already_disabled(false), 3705 already_disabled(false),
3702 extension(extension) {} 3706 extension(extension) {}
3703 3707
3704 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3708 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3705 const Extension* extension, 3709 const Extension* extension,
3706 const ExtensionPermissionSet* permissions, 3710 const ExtensionPermissionSet* permissions,
3707 Reason reason) 3711 Reason reason)
3708 : reason(reason), 3712 : reason(reason),
3709 extension(extension), 3713 extension(extension),
3710 permissions(permissions) {} 3714 permissions(permissions) {}
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api_unittest.cc ('k') | chrome/common/extensions/feature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698