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

Side by Side Diff: extensions/common/permissions/permissions_data.cc

Issue 241673002: Support a "policy" extension location in extension features files. At the same (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: different approach (yoz) Created 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "extensions/common/permissions/permissions_data.h" 5 #include "extensions/common/permissions/permissions_data.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 // The feature should exist since we just got an APIPermission for it. The 128 // The feature should exist since we just got an APIPermission for it. The
129 // two systems should be updated together whenever a permission is added. 129 // two systems should be updated together whenever a permission is added.
130 DCHECK(feature) << "Could not find feature for " << iter->name(); 130 DCHECK(feature) << "Could not find feature for " << iter->name();
131 // http://crbug.com/176381 131 // http://crbug.com/176381
132 if (!feature) { 132 if (!feature) {
133 to_remove.push_back(iter->id()); 133 to_remove.push_back(iter->id());
134 continue; 134 continue;
135 } 135 }
136 136
137 Feature::Availability availability = feature->IsAvailableToManifest( 137 Feature::Availability availability =
138 extension->id(), 138 feature->IsAvailableToExtension(extension);
139 extension->GetType(),
140 Feature::ConvertLocation(extension->location()),
141 extension->manifest_version());
142 139
143 if (!availability.is_available()) { 140 if (!availability.is_available()) {
144 // Don't fail, but warn the developer that the manifest contains 141 // Don't fail, but warn the developer that the manifest contains
145 // unrecognized permissions. This may happen legitimately if the 142 // unrecognized permissions. This may happen legitimately if the
146 // extensions requests platform- or channel-specific permissions. 143 // extensions requests platform- or channel-specific permissions.
147 extension->AddInstallWarning(InstallWarning(availability.message(), 144 extension->AddInstallWarning(InstallWarning(availability.message(),
148 feature->name())); 145 feature->name()));
149 to_remove.push_back(iter->id()); 146 to_remove.push_back(iter->id());
150 continue; 147 continue;
151 } 148 }
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 initial_optional_permissions_->api_permissions, 605 initial_optional_permissions_->api_permissions,
609 initial_optional_permissions_->manifest_permissions, 606 initial_optional_permissions_->manifest_permissions,
610 initial_optional_permissions_->host_permissions, 607 initial_optional_permissions_->host_permissions,
611 URLPatternSet()); 608 URLPatternSet());
612 609
613 initial_required_permissions_.reset(); 610 initial_required_permissions_.reset();
614 initial_optional_permissions_.reset(); 611 initial_optional_permissions_.reset();
615 } 612 }
616 613
617 } // namespace extensions 614 } // namespace extensions
OLDNEW
« extensions/common/features/simple_feature_unittest.cc ('K') | « extensions/common/manifest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698