| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // Container for AvailabiltyResult that also exposes a user-visible error | 68 // Container for AvailabiltyResult that also exposes a user-visible error |
| 69 // message in cases where the feature is not available. | 69 // message in cases where the feature is not available. |
| 70 class Availability { | 70 class Availability { |
| 71 public: | 71 public: |
| 72 AvailabilityResult result() const { return result_; } | 72 AvailabilityResult result() const { return result_; } |
| 73 bool is_available() const { return result_ == IS_AVAILABLE; } | 73 bool is_available() const { return result_ == IS_AVAILABLE; } |
| 74 const std::string& message() const { return message_; } | 74 const std::string& message() const { return message_; } |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 friend class SimpleFeature; | 77 friend class SimpleFeature; |
| 78 friend class Feature; | |
| 79 | 78 |
| 80 // Instances should be created via Feature::CreateAvailability. | 79 // Instances should be created via Feature::CreateAvailability. |
| 81 Availability(AvailabilityResult result, const std::string& message) | 80 Availability(AvailabilityResult result, const std::string& message) |
| 82 : result_(result), message_(message) { } | 81 : result_(result), message_(message) { } |
| 83 | 82 |
| 84 const AvailabilityResult result_; | 83 const AvailabilityResult result_; |
| 85 const std::string message_; | 84 const std::string message_; |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 virtual ~Feature(); | 87 virtual ~Feature(); |
| 89 | 88 |
| 90 // Used by ChromeV8Context until the feature system is fully functional. | |
| 91 static Availability CreateAvailability(AvailabilityResult result, | |
| 92 const std::string& message); | |
| 93 | |
| 94 // Gets the current channel as seen by the Feature system. | 89 // Gets the current channel as seen by the Feature system. |
| 95 static chrome::VersionInfo::Channel GetCurrentChannel(); | 90 static chrome::VersionInfo::Channel GetCurrentChannel(); |
| 96 | 91 |
| 97 // Sets the current channel as seen by the Feature system. In the browser | 92 // Sets the current channel as seen by the Feature system. In the browser |
| 98 // process this should be chrome::VersionInfo::GetChannel(), and in the | 93 // process this should be chrome::VersionInfo::GetChannel(), and in the |
| 99 // renderer this will need to come from an IPC. | 94 // renderer this will need to come from an IPC. |
| 100 static void SetCurrentChannel(chrome::VersionInfo::Channel channel); | 95 static void SetCurrentChannel(chrome::VersionInfo::Channel channel); |
| 101 | 96 |
| 102 // Gets the default channel as seen by the Feature system. | 97 // Gets the default channel as seen by the Feature system. |
| 103 static chrome::VersionInfo::Channel GetDefaultChannel(); | 98 static chrome::VersionInfo::Channel GetDefaultChannel(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 virtual std::string GetAvailabilityMessage( | 154 virtual std::string GetAvailabilityMessage( |
| 160 AvailabilityResult result, Manifest::Type type) const = 0; | 155 AvailabilityResult result, Manifest::Type type) const = 0; |
| 161 | 156 |
| 162 protected: | 157 protected: |
| 163 std::string name_; | 158 std::string name_; |
| 164 }; | 159 }; |
| 165 | 160 |
| 166 } // namespace extensions | 161 } // namespace extensions |
| 167 | 162 |
| 168 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ | 163 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ |
| OLD | NEW |