| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 const GURL& devtools_url() const { return devtools_url_; } | 271 const GURL& devtools_url() const { return devtools_url_; } |
| 272 const std::vector<GURL>& toolstrips() const { return toolstrips_; } | 272 const std::vector<GURL>& toolstrips() const { return toolstrips_; } |
| 273 const std::vector<std::string>& api_permissions() const { | 273 const std::vector<std::string>& api_permissions() const { |
| 274 return api_permissions_; | 274 return api_permissions_; |
| 275 } | 275 } |
| 276 const URLPatternList& host_permissions() const { | 276 const URLPatternList& host_permissions() const { |
| 277 return host_permissions_; | 277 return host_permissions_; |
| 278 } | 278 } |
| 279 | 279 |
| 280 // Returns true if the extension has the specified API permission. | 280 // Returns true if the extension has the specified API permission. |
| 281 static bool HasApiPermission(const std::vector<std::string>& api_permissions, |
| 282 const std::string& permission); |
| 283 |
| 281 bool HasApiPermission(const std::string& permission) const { | 284 bool HasApiPermission(const std::string& permission) const { |
| 282 return std::find(api_permissions_.begin(), api_permissions_.end(), | 285 return HasApiPermission(this->api_permissions(), permission); |
| 283 permission) != api_permissions_.end(); | |
| 284 } | 286 } |
| 285 | 287 |
| 286 // Returns the set of hosts that the extension effectively has access to. This | 288 // Returns the set of hosts that the extension effectively has access to. This |
| 287 // is used in the permissions UI and is a combination of the hosts accessible | 289 // is used in the permissions UI and is a combination of the hosts accessible |
| 288 // through content scripts and the hosts accessible through XHR. | 290 // through content scripts and the hosts accessible through XHR. |
| 289 const ExtensionExtent GetEffectiveHostPermissions() const; | 291 const ExtensionExtent GetEffectiveHostPermissions() const; |
| 290 | 292 |
| 291 // Whether or not the extension is allowed permission for a URL pattern from | 293 // Whether or not the extension is allowed permission for a URL pattern from |
| 292 // the manifest. http, https, and chrome://favicon/ is allowed for all | 294 // the manifest. http, https, and chrome://favicon/ is allowed for all |
| 293 // extensions, while component extensions are allowed access to | 295 // extensions, while component extensions are allowed access to |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 scoped_ptr<DictionaryValue> extension_manifest; | 609 scoped_ptr<DictionaryValue> extension_manifest; |
| 608 std::string extension_id; | 610 std::string extension_id; |
| 609 FilePath extension_path; | 611 FilePath extension_path; |
| 610 Extension::Location extension_location; | 612 Extension::Location extension_location; |
| 611 | 613 |
| 612 private: | 614 private: |
| 613 DISALLOW_COPY_AND_ASSIGN(ExtensionInfo); | 615 DISALLOW_COPY_AND_ASSIGN(ExtensionInfo); |
| 614 }; | 616 }; |
| 615 | 617 |
| 616 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 618 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |