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

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

Issue 12770020: Revert 190836 "Implement API features for the Extension API feat..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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/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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 extension_types_ == other.extension_types_ && 201 extension_types_ == other.extension_types_ &&
202 contexts_ == other.contexts_ && 202 contexts_ == other.contexts_ &&
203 matches_ == other.matches_ && 203 matches_ == other.matches_ &&
204 location_ == other.location_ && 204 location_ == other.location_ &&
205 platform_ == other.platform_ && 205 platform_ == other.platform_ &&
206 min_manifest_version_ == other.min_manifest_version_ && 206 min_manifest_version_ == other.min_manifest_version_ &&
207 max_manifest_version_ == other.max_manifest_version_ && 207 max_manifest_version_ == other.max_manifest_version_ &&
208 channel_ == other.channel_; 208 channel_ == other.channel_;
209 } 209 }
210 210
211 std::string SimpleFeature::Parse(const DictionaryValue* value) { 211 void SimpleFeature::Parse(const DictionaryValue* value) {
212 ParseURLPatterns(value, "matches", &matches_); 212 ParseURLPatterns(value, "matches", &matches_);
213 ParseSet(value, "whitelist", &whitelist_); 213 ParseSet(value, "whitelist", &whitelist_);
214 ParseSet(value, "dependencies", &dependencies_);
215 ParseEnumSet<Manifest::Type>(value, "extension_types", &extension_types_, 214 ParseEnumSet<Manifest::Type>(value, "extension_types", &extension_types_,
216 g_mappings.Get().extension_types); 215 g_mappings.Get().extension_types);
217 ParseEnumSet<Context>(value, "contexts", &contexts_, 216 ParseEnumSet<Context>(value, "contexts", &contexts_,
218 g_mappings.Get().contexts); 217 g_mappings.Get().contexts);
219 ParseEnum<Location>(value, "location", &location_, 218 ParseEnum<Location>(value, "location", &location_,
220 g_mappings.Get().locations); 219 g_mappings.Get().locations);
221 ParseEnum<Platform>(value, "platform", &platform_, 220 ParseEnum<Platform>(value, "platform", &platform_,
222 g_mappings.Get().platforms); 221 g_mappings.Get().platforms);
223 value->GetInteger("min_manifest_version", &min_manifest_version_); 222 value->GetInteger("min_manifest_version", &min_manifest_version_);
224 value->GetInteger("max_manifest_version", &max_manifest_version_); 223 value->GetInteger("max_manifest_version", &max_manifest_version_);
225 ParseEnum<VersionInfo::Channel>( 224 ParseEnum<VersionInfo::Channel>(
226 value, "channel", &channel_, 225 value, "channel", &channel_,
227 g_mappings.Get().channels); 226 g_mappings.Get().channels);
228 if (matches_.is_empty() && contexts_.count(WEB_PAGE_CONTEXT) != 0) {
229 return name() + ": Allowing web_page contexts requires supplying a value " +
230 "for matches.";
231 }
232 return "";
233 } 227 }
234 228
235 Feature::Availability SimpleFeature::IsAvailableToManifest( 229 Feature::Availability SimpleFeature::IsAvailableToManifest(
236 const std::string& extension_id, 230 const std::string& extension_id,
237 Manifest::Type type, 231 Manifest::Type type,
238 Location location, 232 Location location,
239 int manifest_version, 233 int manifest_version,
240 Platform platform) const { 234 Platform platform) const {
241 // Component extensions can access any feature. 235 // Component extensions can access any feature.
242 if (location == COMPONENT_LOCATION) 236 if (location == COMPONENT_LOCATION)
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 DCHECK(id_hash.length() == base::kSHA1Length); 426 DCHECK(id_hash.length() == base::kSHA1Length);
433 const std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), 427 const std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(),
434 id_hash.length()); 428 id_hash.length());
435 if (whitelist_.find(hexencoded_id_hash) != whitelist_.end()) 429 if (whitelist_.find(hexencoded_id_hash) != whitelist_.end())
436 return true; 430 return true;
437 431
438 return false; 432 return false;
439 } 433 }
440 434
441 } // namespace extensions 435 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698