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

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

Issue 2705513002: Extensions: Only create Web request rules registry if Declarative Web Request is enabled. (Closed)
Patch Set: Typo Created 3 years, 10 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
OLDNEW
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"
13 #include "extensions/common/manifest.h" 14 #include "extensions/common/manifest.h"
14 15
15 class GURL; 16 class GURL;
16 17
17 namespace extensions { 18 namespace extensions {
18 19
19 class Extension; 20 class Extension;
20 21
21 // Represents a single feature accessible to an extension developer, such as a 22 // Represents a single feature accessible to an extension developer, such as a
22 // top-level manifest key, a permission, or a programmatic API. A feature can 23 // 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
129 Availability IsAvailableToContext(const Extension* extension, 130 Availability IsAvailableToContext(const Extension* extension,
130 Context context, 131 Context context,
131 const GURL& url) const { 132 const GURL& url) const {
132 return IsAvailableToContext(extension, context, url, GetCurrentPlatform()); 133 return IsAvailableToContext(extension, context, url, GetCurrentPlatform());
133 } 134 }
134 virtual Availability IsAvailableToContext(const Extension* extension, 135 virtual Availability IsAvailableToContext(const Extension* extension,
135 Context context, 136 Context context,
136 const GURL& url, 137 const GURL& url,
137 Platform platform) const = 0; 138 Platform platform) const = 0;
138 139
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(
karandeepb 2017/02/17 02:07:57 I couldn't find an existing way to check if an API
144 version_info::Channel channel) const = 0;
145
139 // Returns true if the feature is available to the current environment, 146 // Returns true if the feature is available to the current environment,
140 // without needing to know information about an Extension or any other 147 // without needing to know information about an Extension or any other
141 // contextual information. Typically used when the Feature is purely 148 // contextual information. Typically used when the Feature is purely
142 // configured by command line flags and/or Chrome channel. 149 // configured by command line flags and/or Chrome channel.
143 // 150 //
144 // Generally try not to use this function. Even if you don't think a Feature 151 // Generally try not to use this function. Even if you don't think a Feature
145 // relies on an Extension now - maybe it will, one day, so if there's an 152 // relies on an Extension now - maybe it will, one day, so if there's an
146 // Extension available (or a runtime context, etc) then use the more targeted 153 // Extension available (or a runtime context, etc) then use the more targeted
147 // method instead. 154 // method instead.
148 Availability IsAvailableToEnvironment() const; 155 Availability IsAvailableToEnvironment() const;
149 156
150 virtual bool IsIdInBlacklist(const std::string& extension_id) const = 0; 157 virtual bool IsIdInBlacklist(const std::string& extension_id) const = 0;
151 virtual bool IsIdInWhitelist(const std::string& extension_id) const = 0; 158 virtual bool IsIdInWhitelist(const std::string& extension_id) const = 0;
152 159
153 protected: 160 protected:
154 std::string name_; 161 std::string name_;
155 std::string alias_; 162 std::string alias_;
156 std::string source_; 163 std::string source_;
157 bool no_parent_; 164 bool no_parent_;
158 }; 165 };
159 166
160 } // namespace extensions 167 } // namespace extensions
161 168
162 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_H_ 169 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698