Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(666)

Side by Side Diff: chrome/common/extensions/features/feature.h

Issue 12846011: Implement API features for the Extension API feature system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed memory leak Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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();
91 virtual ~Feature(); 92 virtual ~Feature();
92 93
93 // Used by ChromeV8Context until the feature system is fully functional. 94 // Used by ChromeV8Context until the feature system is fully functional.
94 static Availability CreateAvailability(AvailabilityResult result, 95 static Availability CreateAvailability(AvailabilityResult result,
95 const std::string& message); 96 const std::string& message);
96 97
97 // Gets the current channel as seen by the Feature system. 98 // Gets the current channel as seen by the Feature system.
98 static chrome::VersionInfo::Channel GetCurrentChannel(); 99 static chrome::VersionInfo::Channel GetCurrentChannel();
99 100
100 // Sets the current channel as seen by the Feature system. In the browser 101 // Sets the current channel as seen by the Feature system. In the browser
(...skipping 16 matching lines...) Expand all
117 ~ScopedCurrentChannel() { 118 ~ScopedCurrentChannel() {
118 SetCurrentChannel(original_channel_); 119 SetCurrentChannel(original_channel_);
119 } 120 }
120 121
121 private: 122 private:
122 chrome::VersionInfo::Channel original_channel_; 123 chrome::VersionInfo::Channel original_channel_;
123 }; 124 };
124 125
125 const std::string& name() const { return name_; } 126 const std::string& name() const { return name_; }
126 void set_name(const std::string& name) { name_ = name; } 127 void set_name(const std::string& name) { name_ = name; }
128 const std::set<std::string>& dependencies() { return dependencies_; }
127 129
128 // Gets the platform the code is currently running on. 130 // Gets the platform the code is currently running on.
129 static Platform GetCurrentPlatform(); 131 static Platform GetCurrentPlatform();
130 132
131 // Gets the Feature::Location value for the specified Manifest::Location. 133 // Gets the Feature::Location value for the specified Manifest::Location.
132 static Location ConvertLocation(Manifest::Location extension_location); 134 static Location ConvertLocation(Manifest::Location extension_location);
133 135
134 // TODO(justinlin): Remove and move to APIFeature when it exists.
135 virtual std::set<Context>* GetContexts() = 0; 136 virtual std::set<Context>* GetContexts() = 0;
136 137
137 // Returns true if the feature is available to be parsed into a new extension 138 // Returns true if the feature is available to be parsed into a new extension
138 // manifest. 139 // manifest.
139 Availability IsAvailableToManifest(const std::string& extension_id, 140 Availability IsAvailableToManifest(const std::string& extension_id,
140 Manifest::Type type, 141 Manifest::Type type,
141 Location location, 142 Location location,
142 int manifest_version) const { 143 int manifest_version) const {
143 return IsAvailableToManifest(extension_id, type, location, manifest_version, 144 return IsAvailableToManifest(extension_id, type, location, manifest_version,
144 GetCurrentPlatform()); 145 GetCurrentPlatform());
(...skipping 15 matching lines...) Expand all
160 Context context, 161 Context context,
161 const GURL& url, 162 const GURL& url,
162 Platform platform) const = 0; 163 Platform platform) const = 0;
163 164
164 virtual std::string GetAvailabilityMessage(AvailabilityResult result, 165 virtual std::string GetAvailabilityMessage(AvailabilityResult result,
165 Manifest::Type type, 166 Manifest::Type type,
166 const GURL& url) const = 0; 167 const GURL& url) const = 0;
167 168
168 protected: 169 protected:
169 std::string name_; 170 std::string name_;
171 std::set<std::string> dependencies_;
170 }; 172 };
171 173
172 } // namespace extensions 174 } // namespace extensions
173 175
174 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ 176 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/features/base_feature_provider_unittest.cc ('k') | chrome/common/extensions/features/feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698