| 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 #ifndef EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ | 5 #ifndef EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ |
| 6 #define EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ | 6 #define EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <set> | 11 #include <set> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
| 15 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 16 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/scoped_ptr.h" | |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| 21 #include "extensions/common/features/feature.h" | 21 #include "extensions/common/features/feature.h" |
| 22 #include "extensions/common/features/simple_feature_filter.h" | 22 #include "extensions/common/features/simple_feature_filter.h" |
| 23 #include "extensions/common/manifest.h" | 23 #include "extensions/common/manifest.h" |
| 24 | 24 |
| 25 namespace extensions { | 25 namespace extensions { |
| 26 | 26 |
| 27 class BaseFeatureProviderTest; | 27 class BaseFeatureProviderTest; |
| 28 class ExtensionAPITest; | 28 class ExtensionAPITest; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 45 | 45 |
| 46 SimpleFeature(); | 46 SimpleFeature(); |
| 47 ~SimpleFeature() override; | 47 ~SimpleFeature() override; |
| 48 | 48 |
| 49 // Dependency resolution is a property of Features that is preferrably | 49 // Dependency resolution is a property of Features that is preferrably |
| 50 // handled internally to avoid temptation, but FeatureFilters may need | 50 // handled internally to avoid temptation, but FeatureFilters may need |
| 51 // to know if there are any at all. | 51 // to know if there are any at all. |
| 52 bool HasDependencies() const; | 52 bool HasDependencies() const; |
| 53 | 53 |
| 54 // Adds a filter to this feature. The feature takes ownership of the filter. | 54 // Adds a filter to this feature. The feature takes ownership of the filter. |
| 55 void AddFilter(scoped_ptr<SimpleFeatureFilter> filter); | 55 void AddFilter(std::unique_ptr<SimpleFeatureFilter> filter); |
| 56 | 56 |
| 57 // Parses the JSON representation of a feature into the fields of this object. | 57 // Parses the JSON representation of a feature into the fields of this object. |
| 58 // Unspecified values in the JSON are not modified in the object. This allows | 58 // Unspecified values in the JSON are not modified in the object. This allows |
| 59 // us to implement inheritance by parsing one value after another. Returns | 59 // us to implement inheritance by parsing one value after another. Returns |
| 60 // the error found, or an empty string on success. | 60 // the error found, or an empty string on success. |
| 61 virtual std::string Parse(const base::DictionaryValue* dictionary); | 61 virtual std::string Parse(const base::DictionaryValue* dictionary); |
| 62 | 62 |
| 63 Availability IsAvailableToContext(const Extension* extension, | 63 Availability IsAvailableToContext(const Extension* extension, |
| 64 Context context) const { | 64 Context context) const { |
| 65 return IsAvailableToContext(extension, context, GURL()); | 65 return IsAvailableToContext(extension, context, GURL()); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 std::vector<Manifest::Type> extension_types_; | 198 std::vector<Manifest::Type> extension_types_; |
| 199 std::vector<Context> contexts_; | 199 std::vector<Context> contexts_; |
| 200 std::vector<Platform> platforms_; | 200 std::vector<Platform> platforms_; |
| 201 URLPatternSet matches_; | 201 URLPatternSet matches_; |
| 202 Location location_; | 202 Location location_; |
| 203 int min_manifest_version_; | 203 int min_manifest_version_; |
| 204 int max_manifest_version_; | 204 int max_manifest_version_; |
| 205 bool component_extensions_auto_granted_; | 205 bool component_extensions_auto_granted_; |
| 206 std::string command_line_switch_; | 206 std::string command_line_switch_; |
| 207 | 207 |
| 208 std::vector<scoped_ptr<SimpleFeatureFilter>> filters_; | 208 std::vector<std::unique_ptr<SimpleFeatureFilter>> filters_; |
| 209 | 209 |
| 210 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); | 210 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 } // namespace extensions | 213 } // namespace extensions |
| 214 | 214 |
| 215 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ | 215 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ |
| OLD | NEW |