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

Side by Side Diff: chrome/common/extensions/features/simple_feature.cc

Issue 49333004: Make app APIs implicit within _api_features.json not _permission_features.json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete component extension granting Created 7 years, 1 month 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/features/simple_feature.h" 5 #include "chrome/common/extensions/features/simple_feature.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 return std::string(); 307 return std::string();
308 } 308 }
309 309
310 Feature::Availability SimpleFeature::IsAvailableToManifest( 310 Feature::Availability SimpleFeature::IsAvailableToManifest(
311 const std::string& extension_id, 311 const std::string& extension_id,
312 Manifest::Type type, 312 Manifest::Type type,
313 Location location, 313 Location location,
314 int manifest_version, 314 int manifest_version,
315 Platform platform) const { 315 Platform platform) const {
316 // Component extensions can access any feature.
317 if (location == COMPONENT_LOCATION)
318 return CreateAvailability(IS_AVAILABLE, type);
319
320 if (!whitelist_.empty()) { 316 if (!whitelist_.empty()) {
321 if (!IsIdInWhitelist(extension_id)) { 317 if (!IsIdInWhitelist(extension_id)) {
322 // TODO(aa): This is gross. There should be a better way to test the 318 // TODO(aa): This is gross. There should be a better way to test the
323 // whitelist. 319 // whitelist.
324 CommandLine* command_line = CommandLine::ForCurrentProcess(); 320 CommandLine* command_line = CommandLine::ForCurrentProcess();
325 if (!command_line->HasSwitch(switches::kWhitelistedExtensionID)) 321 if (!command_line->HasSwitch(switches::kWhitelistedExtensionID))
326 return CreateAvailability(NOT_FOUND_IN_WHITELIST, type); 322 return CreateAvailability(NOT_FOUND_IN_WHITELIST, type);
327 323
328 std::string whitelist_switch_value = 324 std::string whitelist_switch_value =
329 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 325 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 500
505 if (whitelist.find(extension_id) != whitelist.end() || 501 if (whitelist.find(extension_id) != whitelist.end() ||
506 whitelist.find(HashExtensionId(extension_id)) != whitelist.end()) { 502 whitelist.find(HashExtensionId(extension_id)) != whitelist.end()) {
507 return true; 503 return true;
508 } 504 }
509 505
510 return false; 506 return false;
511 } 507 }
512 508
513 } // namespace extensions 509 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/_permission_features.json ('k') | chrome/common/extensions/permissions/chrome_api_permissions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698