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

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

Issue 265503003: Enable file_handlers and chrome.app.runtime for QuickOffice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback, less hacky Created 6 years, 7 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
« no previous file with comments | « extensions/common/features/feature.h ('k') | extensions/common/features/simple_feature.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void set_location(Location location) { location_ = location; } 46 void set_location(Location location) { location_ = location; }
47 int min_manifest_version() const { return min_manifest_version_; } 47 int min_manifest_version() const { return min_manifest_version_; }
48 void set_min_manifest_version(int min_manifest_version) { 48 void set_min_manifest_version(int min_manifest_version) {
49 min_manifest_version_ = min_manifest_version; 49 min_manifest_version_ = min_manifest_version;
50 } 50 }
51 int max_manifest_version() const { return max_manifest_version_; } 51 int max_manifest_version() const { return max_manifest_version_; }
52 void set_max_manifest_version(int max_manifest_version) { 52 void set_max_manifest_version(int max_manifest_version) {
53 max_manifest_version_ = max_manifest_version; 53 max_manifest_version_ = max_manifest_version;
54 } 54 }
55 55
56 std::set<std::string>* blacklist() { return &blacklist_; }
56 std::set<std::string>* whitelist() { return &whitelist_; } 57 std::set<std::string>* whitelist() { return &whitelist_; }
57 std::set<Manifest::Type>* extension_types() { return &extension_types_; } 58 std::set<Manifest::Type>* extension_types() { return &extension_types_; }
58 59
59 // Adds a filter to this feature. The feature takes ownership of the filter. 60 // Adds a filter to this feature. The feature takes ownership of the filter.
60 void AddFilter(scoped_ptr<SimpleFeatureFilter> filter); 61 void AddFilter(scoped_ptr<SimpleFeatureFilter> filter);
61 62
62 // Parses the JSON representation of a feature into the fields of this object. 63 // Parses the JSON representation of a feature into the fields of this object.
63 // Unspecified values in the JSON are not modified in the object. This allows 64 // Unspecified values in the JSON are not modified in the object. This allows
64 // us to implement inheritance by parsing one value after another. Returns 65 // us to implement inheritance by parsing one value after another. Returns
65 // the error found, or an empty string on success. 66 // the error found, or an empty string on success.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 virtual std::string GetAvailabilityMessage(AvailabilityResult result, 98 virtual std::string GetAvailabilityMessage(AvailabilityResult result,
98 Manifest::Type type, 99 Manifest::Type type,
99 const GURL& url, 100 const GURL& url,
100 Context context) const OVERRIDE; 101 Context context) const OVERRIDE;
101 102
102 virtual std::set<Context>* GetContexts() OVERRIDE; 103 virtual std::set<Context>* GetContexts() OVERRIDE;
103 104
104 virtual bool IsInternal() const OVERRIDE; 105 virtual bool IsInternal() const OVERRIDE;
105 virtual bool IsBlockedInServiceWorker() const OVERRIDE; 106 virtual bool IsBlockedInServiceWorker() const OVERRIDE;
106 107
108 virtual bool IsIdInBlacklist(const std::string& extension_id) const OVERRIDE;
107 virtual bool IsIdInWhitelist(const std::string& extension_id) const OVERRIDE; 109 virtual bool IsIdInWhitelist(const std::string& extension_id) const OVERRIDE;
108 static bool IsIdInWhitelist(const std::string& extension_id, 110 static bool IsIdInList(const std::string& extension_id,
109 const std::set<std::string>& whitelist); 111 const std::set<std::string>& list);
110 112
111 protected: 113 protected:
112 Availability CreateAvailability(AvailabilityResult result) const; 114 Availability CreateAvailability(AvailabilityResult result) const;
113 Availability CreateAvailability(AvailabilityResult result, 115 Availability CreateAvailability(AvailabilityResult result,
114 Manifest::Type type) const; 116 Manifest::Type type) const;
115 Availability CreateAvailability(AvailabilityResult result, 117 Availability CreateAvailability(AvailabilityResult result,
116 const GURL& url) const; 118 const GURL& url) const;
117 Availability CreateAvailability(AvailabilityResult result, 119 Availability CreateAvailability(AvailabilityResult result,
118 Context context) const; 120 Context context) const;
119 121
120 private: 122 private:
121 bool MatchesManifestLocation(Manifest::Location manifest_location) const; 123 bool MatchesManifestLocation(Manifest::Location manifest_location) const;
122 124
123 // For clarity and consistency, we handle the default value of each of these 125 // For clarity and consistency, we handle the default value of each of these
124 // members the same way: it matches everything. It is up to the higher level 126 // members the same way: it matches everything. It is up to the higher level
125 // code that reads Features out of static data to validate that data and set 127 // code that reads Features out of static data to validate that data and set
126 // sensible defaults. 128 // sensible defaults.
129 std::set<std::string> blacklist_;
127 std::set<std::string> whitelist_; 130 std::set<std::string> whitelist_;
128 std::set<Manifest::Type> extension_types_; 131 std::set<Manifest::Type> extension_types_;
129 std::set<Context> contexts_; 132 std::set<Context> contexts_;
130 URLPatternSet matches_; 133 URLPatternSet matches_;
131 Location location_; 134 Location location_;
132 std::set<Platform> platforms_; 135 std::set<Platform> platforms_;
133 int min_manifest_version_; 136 int min_manifest_version_;
134 int max_manifest_version_; 137 int max_manifest_version_;
135 bool has_parent_; 138 bool has_parent_;
139 bool component_extensions_auto_granted_;
136 140
137 typedef std::vector<linked_ptr<SimpleFeatureFilter> > FilterList; 141 typedef std::vector<linked_ptr<SimpleFeatureFilter> > FilterList;
138 FilterList filters_; 142 FilterList filters_;
139 143
140 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); 144 DISALLOW_COPY_AND_ASSIGN(SimpleFeature);
141 }; 145 };
142 146
143 } // namespace extensions 147 } // namespace extensions
144 148
145 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ 149 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_
OLDNEW
« no previous file with comments | « extensions/common/features/feature.h ('k') | extensions/common/features/simple_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698