Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 void SimpleFeature::Parse(const DictionaryValue* value) { | 211 bool 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_); | |
| 214 ParseEnumSet<Manifest::Type>(value, "extension_types", &extension_types_, | 215 ParseEnumSet<Manifest::Type>(value, "extension_types", &extension_types_, |
| 215 g_mappings.Get().extension_types); | 216 g_mappings.Get().extension_types); |
| 216 ParseEnumSet<Context>(value, "contexts", &contexts_, | 217 ParseEnumSet<Context>(value, "contexts", &contexts_, |
| 217 g_mappings.Get().contexts); | 218 g_mappings.Get().contexts); |
| 218 ParseEnum<Location>(value, "location", &location_, | 219 ParseEnum<Location>(value, "location", &location_, |
| 219 g_mappings.Get().locations); | 220 g_mappings.Get().locations); |
| 220 ParseEnum<Platform>(value, "platform", &platform_, | 221 ParseEnum<Platform>(value, "platform", &platform_, |
| 221 g_mappings.Get().platforms); | 222 g_mappings.Get().platforms); |
| 222 value->GetInteger("min_manifest_version", &min_manifest_version_); | 223 value->GetInteger("min_manifest_version", &min_manifest_version_); |
| 223 value->GetInteger("max_manifest_version", &max_manifest_version_); | 224 value->GetInteger("max_manifest_version", &max_manifest_version_); |
| 224 ParseEnum<VersionInfo::Channel>( | 225 ParseEnum<VersionInfo::Channel>( |
| 225 value, "channel", &channel_, | 226 value, "channel", &channel_, |
| 226 g_mappings.Get().channels); | 227 g_mappings.Get().channels); |
| 228 return true; | |
|
not at google - send to devlin
2013/03/26 00:34:48
i.e. return "" here
cduvall
2013/03/26 19:24:05
Done.
| |
| 227 } | 229 } |
| 228 | 230 |
| 229 Feature::Availability SimpleFeature::IsAvailableToManifest( | 231 Feature::Availability SimpleFeature::IsAvailableToManifest( |
| 230 const std::string& extension_id, | 232 const std::string& extension_id, |
| 231 Manifest::Type type, | 233 Manifest::Type type, |
| 232 Location location, | 234 Location location, |
| 233 int manifest_version, | 235 int manifest_version, |
| 234 Platform platform) const { | 236 Platform platform) const { |
| 235 // Component extensions can access any feature. | 237 // Component extensions can access any feature. |
| 236 if (location == COMPONENT_LOCATION) | 238 if (location == COMPONENT_LOCATION) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 DCHECK(id_hash.length() == base::kSHA1Length); | 428 DCHECK(id_hash.length() == base::kSHA1Length); |
| 427 const std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), | 429 const std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), |
| 428 id_hash.length()); | 430 id_hash.length()); |
| 429 if (whitelist_.find(hexencoded_id_hash) != whitelist_.end()) | 431 if (whitelist_.find(hexencoded_id_hash) != whitelist_.end()) |
| 430 return true; | 432 return true; |
| 431 | 433 |
| 432 return false; | 434 return false; |
| 433 } | 435 } |
| 434 | 436 |
| 435 } // namespace extensions | 437 } // namespace extensions |
| OLD | NEW |