| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 const GURL& devtools_url() const { return devtools_url_; } | 265 const GURL& devtools_url() const { return devtools_url_; } |
| 266 const std::vector<GURL>& toolstrips() const { return toolstrips_; } | 266 const std::vector<GURL>& toolstrips() const { return toolstrips_; } |
| 267 const std::vector<std::string>& api_permissions() const { | 267 const std::vector<std::string>& api_permissions() const { |
| 268 return api_permissions_; | 268 return api_permissions_; |
| 269 } | 269 } |
| 270 const URLPatternList& host_permissions() const { | 270 const URLPatternList& host_permissions() const { |
| 271 return host_permissions_; | 271 return host_permissions_; |
| 272 } | 272 } |
| 273 | 273 |
| 274 // Returns true if the extension has the specified API permission. | 274 // Returns true if the extension has the specified API permission. |
| 275 static bool HasApiPermission(const std::vector<std::string>& api_permissions, |
| 276 const std::string& permission); |
| 277 |
| 275 bool HasApiPermission(const std::string& permission) const { | 278 bool HasApiPermission(const std::string& permission) const { |
| 276 return std::find(api_permissions_.begin(), api_permissions_.end(), | 279 return HasApiPermission(this->api_permissions(), permission); |
| 277 permission) != api_permissions_.end(); | |
| 278 } | 280 } |
| 279 | 281 |
| 280 // Returns the set of hosts that the extension effectively has access to. This | 282 // Returns the set of hosts that the extension effectively has access to. This |
| 281 // is used in the permissions UI and is a combination of the hosts accessible | 283 // is used in the permissions UI and is a combination of the hosts accessible |
| 282 // through content scripts and the hosts accessible through XHR. | 284 // through content scripts and the hosts accessible through XHR. |
| 283 const ExtensionExtent GetEffectiveHostPermissions() const; | 285 const ExtensionExtent GetEffectiveHostPermissions() const; |
| 284 | 286 |
| 285 // Whether or not the extension is allowed permission for a URL pattern from | 287 // Whether or not the extension is allowed permission for a URL pattern from |
| 286 // the manifest. http, https, and chrome://favicon/ is allowed for all | 288 // the manifest. http, https, and chrome://favicon/ is allowed for all |
| 287 // extensions, while component extensions are allowed access to | 289 // extensions, while component extensions are allowed access to |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 scoped_ptr<DictionaryValue> extension_manifest; | 616 scoped_ptr<DictionaryValue> extension_manifest; |
| 615 std::string extension_id; | 617 std::string extension_id; |
| 616 FilePath extension_path; | 618 FilePath extension_path; |
| 617 Extension::Location extension_location; | 619 Extension::Location extension_location; |
| 618 | 620 |
| 619 private: | 621 private: |
| 620 DISALLOW_COPY_AND_ASSIGN(ExtensionInfo); | 622 DISALLOW_COPY_AND_ASSIGN(ExtensionInfo); |
| 621 }; | 623 }; |
| 622 | 624 |
| 623 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 625 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |