OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_PERMISSIONS_PERMISSIONS_DATA_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // permission that effectively grants access to all hosts (e.g. proxy, | 134 // permission that effectively grants access to all hosts (e.g. proxy, |
135 // network, etc.) | 135 // network, etc.) |
136 static bool HasEffectiveAccessToAllHosts(const Extension* extension); | 136 static bool HasEffectiveAccessToAllHosts(const Extension* extension); |
137 | 137 |
138 // Returns the full list of permission messages that the given |extension| | 138 // Returns the full list of permission messages that the given |extension| |
139 // should display at install time. | 139 // should display at install time. |
140 static PermissionMessages GetPermissionMessages(const Extension* extension); | 140 static PermissionMessages GetPermissionMessages(const Extension* extension); |
141 // Returns the full list of permission messages that the given |extension| | 141 // Returns the full list of permission messages that the given |extension| |
142 // should display at install time. The messages are returned as strings | 142 // should display at install time. The messages are returned as strings |
143 // for convenience. | 143 // for convenience. |
144 static std::vector<string16> GetPermissionMessageStrings( | 144 static std::vector<base::string16> GetPermissionMessageStrings( |
145 const Extension* extension); | 145 const Extension* extension); |
146 | 146 |
147 // Returns the full list of permission details for messages that the given | 147 // Returns the full list of permission details for messages that the given |
148 // |extension| should display at install time. The messages are returned as | 148 // |extension| should display at install time. The messages are returned as |
149 // strings for convenience. | 149 // strings for convenience. |
150 static std::vector<string16> GetPermissionMessageDetailsStrings( | 150 static std::vector<base::string16> GetPermissionMessageDetailsStrings( |
151 const Extension* extension); | 151 const Extension* extension); |
152 | 152 |
153 // Returns true if the given |extension| can execute script on a page. If a | 153 // Returns true if the given |extension| can execute script on a page. If a |
154 // UserScript object is passed, permission to run that specific script is | 154 // UserScript object is passed, permission to run that specific script is |
155 // checked (using its matches list). Otherwise, permission to execute script | 155 // checked (using its matches list). Otherwise, permission to execute script |
156 // programmatically is checked (using the extension's host permission). | 156 // programmatically is checked (using the extension's host permission). |
157 // | 157 // |
158 // This method is also aware of certain special pages that extensions are | 158 // This method is also aware of certain special pages that extensions are |
159 // usually not allowed to run script on. | 159 // usually not allowed to run script on. |
160 static bool CanExecuteScriptOnPage(const Extension* extension, | 160 static bool CanExecuteScriptOnPage(const Extension* extension, |
(...skipping 11 matching lines...) Expand all Loading... |
172 // Returns true if the |extension| is allowed to obtain the contents of a | 172 // Returns true if the |extension| is allowed to obtain the contents of a |
173 // page as an image. Since a page may contain sensitive information, this | 173 // page as an image. Since a page may contain sensitive information, this |
174 // is restricted to the extension's host permissions as well as the | 174 // is restricted to the extension's host permissions as well as the |
175 // extension page itself. | 175 // extension page itself. |
176 static bool CanCaptureVisiblePage(const Extension* extension, | 176 static bool CanCaptureVisiblePage(const Extension* extension, |
177 const GURL& page_url, | 177 const GURL& page_url, |
178 int tab_id, | 178 int tab_id, |
179 std::string* error); | 179 std::string* error); |
180 | 180 |
181 // Parse the permissions of a given extension in the initialization process. | 181 // Parse the permissions of a given extension in the initialization process. |
182 bool ParsePermissions(Extension* extension, string16* error); | 182 bool ParsePermissions(Extension* extension, base::string16* error); |
183 | 183 |
184 // Ensure manifest handlers provide their custom manifest permissions. | 184 // Ensure manifest handlers provide their custom manifest permissions. |
185 void InitializeManifestPermissions(Extension* extension); | 185 void InitializeManifestPermissions(Extension* extension); |
186 | 186 |
187 // Finalize permissions after the initialization process completes. | 187 // Finalize permissions after the initialization process completes. |
188 void FinalizePermissions(Extension* extension); | 188 void FinalizePermissions(Extension* extension); |
189 | 189 |
190 private: | 190 private: |
191 struct InitialPermissions; | 191 struct InitialPermissions; |
192 typedef std::map<int, scoped_refptr<const PermissionSet> > TabPermissionsMap; | 192 typedef std::map<int, scoped_refptr<const PermissionSet> > TabPermissionsMap; |
(...skipping 16 matching lines...) Expand all Loading... |
209 mutable scoped_refptr<const PermissionSet> active_permissions_; | 209 mutable scoped_refptr<const PermissionSet> active_permissions_; |
210 | 210 |
211 mutable TabPermissionsMap tab_specific_permissions_; | 211 mutable TabPermissionsMap tab_specific_permissions_; |
212 | 212 |
213 DISALLOW_COPY_AND_ASSIGN(PermissionsData); | 213 DISALLOW_COPY_AND_ASSIGN(PermissionsData); |
214 }; | 214 }; |
215 | 215 |
216 } // namespace extensions | 216 } // namespace extensions |
217 | 217 |
218 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ | 218 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
OLD | NEW |