| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/features/feature_provider.h" | 5 #include "extensions/common/features/feature_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 15 #include "extensions/common/extensions_client.h" | 15 #include "extensions/common/extensions_client.h" |
| 16 #include "extensions/common/features/feature.h" |
| 16 #include "extensions/common/features/feature_util.h" | 17 #include "extensions/common/features/feature_util.h" |
| 17 #include "extensions/common/switches.h" | 18 #include "extensions/common/switches.h" |
| 18 | 19 |
| 19 namespace extensions { | 20 namespace extensions { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 class Static { | 24 class Static { |
| 24 public: | 25 public: |
| 25 FeatureProvider* GetFeatures(const std::string& name) const { | 26 FeatureProvider* GetFeatures(const std::string& name) const { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const Feature* FeatureProvider::GetManifestFeature(const std::string& name) { | 111 const Feature* FeatureProvider::GetManifestFeature(const std::string& name) { |
| 111 return GetFeatureFromProviderByName("manifest", name); | 112 return GetFeatureFromProviderByName("manifest", name); |
| 112 } | 113 } |
| 113 | 114 |
| 114 // static | 115 // static |
| 115 const Feature* FeatureProvider::GetPermissionFeature(const std::string& name) { | 116 const Feature* FeatureProvider::GetPermissionFeature(const std::string& name) { |
| 116 return GetFeatureFromProviderByName("permission", name); | 117 return GetFeatureFromProviderByName("permission", name); |
| 117 } | 118 } |
| 118 | 119 |
| 119 // static | 120 // static |
| 120 const Feature* FeatureProvider::GetBehaviorFeature(const std::string& name) { | 121 bool FeatureProvider::BehaviorFeatureIsAvailable(const std::string& name, |
| 121 return GetFeatureFromProviderByName("behavior", name); | 122 const Extension* extension) { |
| 123 const Feature* behavior_feature = GetBehaviorFeatures()->GetFeature(name); |
| 124 return behavior_feature && |
| 125 behavior_feature->IsAvailableToExtension(extension).is_available(); |
| 122 } | 126 } |
| 123 | 127 |
| 124 } // namespace extensions | 128 } // namespace extensions |
| OLD | NEW |