| 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 #ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_H_ | 5 #ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_H_ |
| 6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_H_ | 6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "components/version_info/version_info.h" | |
| 14 #include "extensions/common/manifest.h" | 13 #include "extensions/common/manifest.h" |
| 15 | 14 |
| 16 class GURL; | 15 class GURL; |
| 17 | 16 |
| 18 namespace extensions { | 17 namespace extensions { |
| 19 | 18 |
| 20 class Extension; | 19 class Extension; |
| 21 | 20 |
| 22 // Represents a single feature accessible to an extension developer, such as a | 21 // Represents a single feature accessible to an extension developer, such as a |
| 23 // top-level manifest key, a permission, or a programmatic API. A feature can | 22 // top-level manifest key, a permission, or a programmatic API. A feature can |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 Availability IsAvailableToContext(const Extension* extension, | 129 Availability IsAvailableToContext(const Extension* extension, |
| 131 Context context, | 130 Context context, |
| 132 const GURL& url) const { | 131 const GURL& url) const { |
| 133 return IsAvailableToContext(extension, context, url, GetCurrentPlatform()); | 132 return IsAvailableToContext(extension, context, url, GetCurrentPlatform()); |
| 134 } | 133 } |
| 135 virtual Availability IsAvailableToContext(const Extension* extension, | 134 virtual Availability IsAvailableToContext(const Extension* extension, |
| 136 Context context, | 135 Context context, |
| 137 const GURL& url, | 136 const GURL& url, |
| 138 Platform platform) const = 0; | 137 Platform platform) const = 0; |
| 139 | 138 |
| 140 // Returns the availability of the feature on the given |channel|. The | |
| 141 // availability result will either be IS_AVAILABLE, UNSUPPORTED_CHANNEL or | |
| 142 // NOT_PRESENT. | |
| 143 virtual Availability IsAvailableToChannel( | |
| 144 version_info::Channel channel) const = 0; | |
| 145 | |
| 146 // Returns true if the feature is available to the current environment, | 139 // Returns true if the feature is available to the current environment, |
| 147 // without needing to know information about an Extension or any other | 140 // without needing to know information about an Extension or any other |
| 148 // contextual information. Typically used when the Feature is purely | 141 // contextual information. Typically used when the Feature is purely |
| 149 // configured by command line flags and/or Chrome channel. | 142 // configured by command line flags and/or Chrome channel. |
| 150 // | 143 // |
| 151 // Generally try not to use this function. Even if you don't think a Feature | 144 // Generally try not to use this function. Even if you don't think a Feature |
| 152 // relies on an Extension now - maybe it will, one day, so if there's an | 145 // relies on an Extension now - maybe it will, one day, so if there's an |
| 153 // Extension available (or a runtime context, etc) then use the more targeted | 146 // Extension available (or a runtime context, etc) then use the more targeted |
| 154 // method instead. | 147 // method instead. |
| 155 Availability IsAvailableToEnvironment() const; | 148 Availability IsAvailableToEnvironment() const; |
| 156 | 149 |
| 157 virtual bool IsIdInBlacklist(const std::string& extension_id) const = 0; | 150 virtual bool IsIdInBlacklist(const std::string& extension_id) const = 0; |
| 158 virtual bool IsIdInWhitelist(const std::string& extension_id) const = 0; | 151 virtual bool IsIdInWhitelist(const std::string& extension_id) const = 0; |
| 159 | 152 |
| 160 protected: | 153 protected: |
| 161 std::string name_; | 154 std::string name_; |
| 162 std::string alias_; | 155 std::string alias_; |
| 163 std::string source_; | 156 std::string source_; |
| 164 bool no_parent_; | 157 bool no_parent_; |
| 165 }; | 158 }; |
| 166 | 159 |
| 167 } // namespace extensions | 160 } // namespace extensions |
| 168 | 161 |
| 169 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_H_ | 162 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_H_ |
| OLD | NEW |