| 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 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 NOT_FOUND_IN_WHITELIST, | 62 NOT_FOUND_IN_WHITELIST, |
| 63 INVALID_URL, | 63 INVALID_URL, |
| 64 INVALID_TYPE, | 64 INVALID_TYPE, |
| 65 INVALID_CONTEXT, | 65 INVALID_CONTEXT, |
| 66 INVALID_LOCATION, | 66 INVALID_LOCATION, |
| 67 INVALID_PLATFORM, | 67 INVALID_PLATFORM, |
| 68 INVALID_MIN_MANIFEST_VERSION, | 68 INVALID_MIN_MANIFEST_VERSION, |
| 69 INVALID_MAX_MANIFEST_VERSION, | 69 INVALID_MAX_MANIFEST_VERSION, |
| 70 NOT_PRESENT, | 70 NOT_PRESENT, |
| 71 UNSUPPORTED_CHANNEL, | 71 UNSUPPORTED_CHANNEL, |
| 72 FOUND_IN_BLACKLIST, |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 // Container for AvailabiltyResult that also exposes a user-visible error | 75 // Container for AvailabiltyResult that also exposes a user-visible error |
| 75 // message in cases where the feature is not available. | 76 // message in cases where the feature is not available. |
| 76 class Availability { | 77 class Availability { |
| 77 public: | 78 public: |
| 78 AvailabilityResult result() const { return result_; } | 79 AvailabilityResult result() const { return result_; } |
| 79 bool is_available() const { return result_ == IS_AVAILABLE; } | 80 bool is_available() const { return result_ == IS_AVAILABLE; } |
| 80 const std::string& message() const { return message_; } | 81 const std::string& message() const { return message_; } |
| 81 | 82 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 virtual Availability IsAvailableToContext(const Extension* extension, | 145 virtual Availability IsAvailableToContext(const Extension* extension, |
| 145 Context context, | 146 Context context, |
| 146 const GURL& url, | 147 const GURL& url, |
| 147 Platform platform) const = 0; | 148 Platform platform) const = 0; |
| 148 | 149 |
| 149 virtual std::string GetAvailabilityMessage(AvailabilityResult result, | 150 virtual std::string GetAvailabilityMessage(AvailabilityResult result, |
| 150 Manifest::Type type, | 151 Manifest::Type type, |
| 151 const GURL& url, | 152 const GURL& url, |
| 152 Context context) const = 0; | 153 Context context) const = 0; |
| 153 | 154 |
| 155 virtual bool IsIdInBlacklist(const std::string& extension_id) const = 0; |
| 154 virtual bool IsIdInWhitelist(const std::string& extension_id) const = 0; | 156 virtual bool IsIdInWhitelist(const std::string& extension_id) const = 0; |
| 155 | 157 |
| 156 protected: | 158 protected: |
| 157 std::string name_; | 159 std::string name_; |
| 158 std::set<std::string> dependencies_; | 160 std::set<std::string> dependencies_; |
| 159 bool no_parent_; | 161 bool no_parent_; |
| 160 }; | 162 }; |
| 161 | 163 |
| 162 } // namespace extensions | 164 } // namespace extensions |
| 163 | 165 |
| 164 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_H_ | 166 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_H_ |
| OLD | NEW |