| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ | 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 friend class Feature; | 81 friend class Feature; |
| 82 | 82 |
| 83 // Instances should be created via Feature::CreateAvailability. | 83 // Instances should be created via Feature::CreateAvailability. |
| 84 Availability(AvailabilityResult result, const std::string& message) | 84 Availability(AvailabilityResult result, const std::string& message) |
| 85 : result_(result), message_(message) { } | 85 : result_(result), message_(message) { } |
| 86 | 86 |
| 87 const AvailabilityResult result_; | 87 const AvailabilityResult result_; |
| 88 const std::string message_; | 88 const std::string message_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 Feature(); | |
| 92 virtual ~Feature(); | 91 virtual ~Feature(); |
| 93 | 92 |
| 94 // Used by ChromeV8Context until the feature system is fully functional. | 93 // Used by ChromeV8Context until the feature system is fully functional. |
| 95 static Availability CreateAvailability(AvailabilityResult result, | 94 static Availability CreateAvailability(AvailabilityResult result, |
| 96 const std::string& message); | 95 const std::string& message); |
| 97 | 96 |
| 98 // Gets the current channel as seen by the Feature system. | 97 // Gets the current channel as seen by the Feature system. |
| 99 static chrome::VersionInfo::Channel GetCurrentChannel(); | 98 static chrome::VersionInfo::Channel GetCurrentChannel(); |
| 100 | 99 |
| 101 // Sets the current channel as seen by the Feature system. In the browser | 100 // Sets the current channel as seen by the Feature system. In the browser |
| (...skipping 16 matching lines...) Expand all Loading... |
| 118 ~ScopedCurrentChannel() { | 117 ~ScopedCurrentChannel() { |
| 119 SetCurrentChannel(original_channel_); | 118 SetCurrentChannel(original_channel_); |
| 120 } | 119 } |
| 121 | 120 |
| 122 private: | 121 private: |
| 123 chrome::VersionInfo::Channel original_channel_; | 122 chrome::VersionInfo::Channel original_channel_; |
| 124 }; | 123 }; |
| 125 | 124 |
| 126 const std::string& name() const { return name_; } | 125 const std::string& name() const { return name_; } |
| 127 void set_name(const std::string& name) { name_ = name; } | 126 void set_name(const std::string& name) { name_ = name; } |
| 128 const std::set<std::string>& dependencies() { return dependencies_; } | |
| 129 | 127 |
| 130 // Gets the platform the code is currently running on. | 128 // Gets the platform the code is currently running on. |
| 131 static Platform GetCurrentPlatform(); | 129 static Platform GetCurrentPlatform(); |
| 132 | 130 |
| 133 // Gets the Feature::Location value for the specified Manifest::Location. | 131 // Gets the Feature::Location value for the specified Manifest::Location. |
| 134 static Location ConvertLocation(Manifest::Location extension_location); | 132 static Location ConvertLocation(Manifest::Location extension_location); |
| 135 | 133 |
| 134 // TODO(justinlin): Remove and move to APIFeature when it exists. |
| 136 virtual std::set<Context>* GetContexts() = 0; | 135 virtual std::set<Context>* GetContexts() = 0; |
| 137 | 136 |
| 138 // Returns true if the feature is available to be parsed into a new extension | 137 // Returns true if the feature is available to be parsed into a new extension |
| 139 // manifest. | 138 // manifest. |
| 140 Availability IsAvailableToManifest(const std::string& extension_id, | 139 Availability IsAvailableToManifest(const std::string& extension_id, |
| 141 Manifest::Type type, | 140 Manifest::Type type, |
| 142 Location location, | 141 Location location, |
| 143 int manifest_version) const { | 142 int manifest_version) const { |
| 144 return IsAvailableToManifest(extension_id, type, location, manifest_version, | 143 return IsAvailableToManifest(extension_id, type, location, manifest_version, |
| 145 GetCurrentPlatform()); | 144 GetCurrentPlatform()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 161 Context context, | 160 Context context, |
| 162 const GURL& url, | 161 const GURL& url, |
| 163 Platform platform) const = 0; | 162 Platform platform) const = 0; |
| 164 | 163 |
| 165 virtual std::string GetAvailabilityMessage(AvailabilityResult result, | 164 virtual std::string GetAvailabilityMessage(AvailabilityResult result, |
| 166 Manifest::Type type, | 165 Manifest::Type type, |
| 167 const GURL& url) const = 0; | 166 const GURL& url) const = 0; |
| 168 | 167 |
| 169 protected: | 168 protected: |
| 170 std::string name_; | 169 std::string name_; |
| 171 std::set<std::string> dependencies_; | |
| 172 }; | 170 }; |
| 173 | 171 |
| 174 } // namespace extensions | 172 } // namespace extensions |
| 175 | 173 |
| 176 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ | 174 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ |
| OLD | NEW |