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

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

Issue 2241203003: Pass user session type to extension feature checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out some stuff Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SIMPLE_FEATURE_H_ 5 #ifndef EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_
6 #define EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ 6 #define EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <initializer_list> 10 #include <initializer_list>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Parses the JSON representation of a feature into the fields of this object. 50 // Parses the JSON representation of a feature into the fields of this object.
51 // Note: Validate() should be called after this. 51 // Note: Validate() should be called after this.
52 void Parse(const base::DictionaryValue* dictionary); 52 void Parse(const base::DictionaryValue* dictionary);
53 53
54 // Checks whether the feature is valid. Invalid features should not be used. 54 // Checks whether the feature is valid. Invalid features should not be used.
55 // Subclasses can override to implement specific checking, but should always 55 // Subclasses can override to implement specific checking, but should always
56 // call this method as well. 56 // call this method as well.
57 virtual bool Validate(std::string* error); 57 virtual bool Validate(std::string* error);
58 58
59 Availability IsAvailableToContext(const Extension* extension, 59 Availability IsAvailableToContext(const Extension* extension,
60 Context context) const { 60 Context context,
61 return IsAvailableToContext(extension, context, GURL()); 61 SessionType session_type) const {
62 return IsAvailableToContext(extension, context, session_type, GURL());
62 } 63 }
63 Availability IsAvailableToContext(const Extension* extension, 64 Availability IsAvailableToContext(const Extension* extension,
64 Context context, 65 Context context,
66 SessionType session_type,
65 Platform platform) const { 67 Platform platform) const {
66 return IsAvailableToContext(extension, context, GURL(), platform); 68 return IsAvailableToContext(extension, context, session_type, GURL(),
69 platform);
67 } 70 }
68 Availability IsAvailableToContext(const Extension* extension, 71 Availability IsAvailableToContext(const Extension* extension,
69 Context context, 72 Context context,
73 SessionType session_type,
70 const GURL& url) const { 74 const GURL& url) const {
71 return IsAvailableToContext(extension, context, url, GetCurrentPlatform()); 75 return IsAvailableToContext(extension, context, session_type, url,
76 GetCurrentPlatform());
72 } 77 }
73 78
74 // extension::Feature: 79 // extension::Feature:
75 Availability IsAvailableToManifest(const std::string& extension_id, 80 Availability IsAvailableToManifest(const std::string& extension_id,
76 Manifest::Type type, 81 Manifest::Type type,
77 Manifest::Location location, 82 Manifest::Location location,
78 int manifest_version, 83 int manifest_version,
79 Platform platform) const override; 84 Platform platform) const override;
80 Availability IsAvailableToContext(const Extension* extension, 85 Availability IsAvailableToContext(const Extension* extension,
81 Context context, 86 Context context,
87 SessionType session_type,
82 const GURL& url, 88 const GURL& url,
83 Platform platform) const override; 89 Platform platform) const override;
84 bool IsInternal() const override; 90 bool IsInternal() const override;
85 bool IsIdInBlacklist(const std::string& extension_id) const override; 91 bool IsIdInBlacklist(const std::string& extension_id) const override;
86 bool IsIdInWhitelist(const std::string& extension_id) const override; 92 bool IsIdInWhitelist(const std::string& extension_id) const override;
87 93
88 static bool IsIdInArray(const std::string& extension_id, 94 static bool IsIdInArray(const std::string& extension_id,
89 const char* const array[], 95 const char* const array[],
90 size_t array_length); 96 size_t array_length);
91 97
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 bool is_internal_; 238 bool is_internal_;
233 std::string command_line_switch_; 239 std::string command_line_switch_;
234 std::unique_ptr<version_info::Channel> channel_; 240 std::unique_ptr<version_info::Channel> channel_;
235 241
236 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); 242 DISALLOW_COPY_AND_ASSIGN(SimpleFeature);
237 }; 243 };
238 244
239 } // namespace extensions 245 } // namespace extensions
240 246
241 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ 247 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698