| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/features/simple_feature.h" | 5 #include "extensions/common/features/simple_feature.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 max_manifest_version_(0), | 290 max_manifest_version_(0), |
| 291 component_extensions_auto_granted_(true) {} | 291 component_extensions_auto_granted_(true) {} |
| 292 | 292 |
| 293 SimpleFeature::~SimpleFeature() {} | 293 SimpleFeature::~SimpleFeature() {} |
| 294 | 294 |
| 295 bool SimpleFeature::HasDependencies() const { | 295 bool SimpleFeature::HasDependencies() const { |
| 296 return !dependencies_.empty(); | 296 return !dependencies_.empty(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void SimpleFeature::AddFilter(scoped_ptr<SimpleFeatureFilter> filter) { | 299 void SimpleFeature::AddFilter(scoped_ptr<SimpleFeatureFilter> filter) { |
| 300 filters_.push_back(filter.release()); | 300 filters_.push_back(filter.Pass()); |
| 301 } | 301 } |
| 302 | 302 |
| 303 std::string SimpleFeature::Parse(const base::DictionaryValue* dictionary) { | 303 std::string SimpleFeature::Parse(const base::DictionaryValue* dictionary) { |
| 304 static base::LazyInstance<SimpleFeature::Mappings> mappings = | 304 static base::LazyInstance<SimpleFeature::Mappings> mappings = |
| 305 LAZY_INSTANCE_INITIALIZER; | 305 LAZY_INSTANCE_INITIALIZER; |
| 306 | 306 |
| 307 no_parent_ = false; | 307 no_parent_ = false; |
| 308 for (base::DictionaryValue::Iterator it(*dictionary); | 308 for (base::DictionaryValue::Iterator it(*dictionary); |
| 309 !it.IsAtEnd(); | 309 !it.IsAtEnd(); |
| 310 it.Advance()) { | 310 it.Advance()) { |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 bool SimpleFeature::IsValidExtensionId(const std::string& extension_id) { | 632 bool SimpleFeature::IsValidExtensionId(const std::string& extension_id) { |
| 633 // Belt-and-suspenders philosophy here. We should be pretty confident by this | 633 // Belt-and-suspenders philosophy here. We should be pretty confident by this |
| 634 // point that we've validated the extension ID format, but in case something | 634 // point that we've validated the extension ID format, but in case something |
| 635 // slips through, we avoid a class of attack where creative ID manipulation | 635 // slips through, we avoid a class of attack where creative ID manipulation |
| 636 // leads to hash collisions. | 636 // leads to hash collisions. |
| 637 // 128 bits / 4 = 32 mpdecimal characters | 637 // 128 bits / 4 = 32 mpdecimal characters |
| 638 return (extension_id.length() == 32); | 638 return (extension_id.length() == 32); |
| 639 } | 639 } |
| 640 | 640 |
| 641 } // namespace extensions | 641 } // namespace extensions |
| OLD | NEW |