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 #include "extensions/common/extension.h" | 5 #include "extensions/common/extension.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "base/version.h" | 22 #include "base/version.h" |
23 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
24 #include "extensions/common/constants.h" | 24 #include "extensions/common/constants.h" |
25 #include "extensions/common/error_utils.h" | 25 #include "extensions/common/error_utils.h" |
26 #include "extensions/common/id_util.h" | 26 #include "extensions/common/id_util.h" |
27 #include "extensions/common/manifest.h" | 27 #include "extensions/common/manifest.h" |
28 #include "extensions/common/manifest_constants.h" | 28 #include "extensions/common/manifest_constants.h" |
29 #include "extensions/common/manifest_handler.h" | 29 #include "extensions/common/manifest_handler.h" |
30 #include "extensions/common/manifest_handlers/permissions_parser.h" | 30 #include "extensions/common/manifest_handlers/permissions_parser.h" |
31 #include "extensions/common/permissions/api_permission_set.h" | |
32 #include "extensions/common/permissions/permission_set.h" | 31 #include "extensions/common/permissions/permission_set.h" |
33 #include "extensions/common/permissions/permissions_data.h" | 32 #include "extensions/common/permissions/permissions_data.h" |
34 #include "extensions/common/permissions/permissions_info.h" | 33 #include "extensions/common/permissions/permissions_info.h" |
35 #include "extensions/common/switches.h" | 34 #include "extensions/common/switches.h" |
36 #include "extensions/common/url_pattern_set.h" | 35 #include "extensions/common/url_pattern.h" |
37 #include "net/base/filename_util.h" | 36 #include "net/base/filename_util.h" |
38 #include "url/url_util.h" | 37 #include "url/url_util.h" |
39 | 38 |
40 namespace extensions { | 39 namespace extensions { |
41 | 40 |
42 namespace keys = manifest_keys; | 41 namespace keys = manifest_keys; |
43 namespace values = manifest_values; | 42 namespace values = manifest_values; |
44 namespace errors = manifest_errors; | 43 namespace errors = manifest_errors; |
45 | 44 |
46 namespace { | 45 namespace { |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 279 |
281 return true; | 280 return true; |
282 } | 281 } |
283 | 282 |
284 // static | 283 // static |
285 GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) { | 284 GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) { |
286 return GURL(std::string(extensions::kExtensionScheme) + | 285 return GURL(std::string(extensions::kExtensionScheme) + |
287 url::kStandardSchemeSeparator + extension_id + "/"); | 286 url::kStandardSchemeSeparator + extension_id + "/"); |
288 } | 287 } |
289 | 288 |
290 bool Extension::HasAPIPermission(APIPermission::ID permission) const { | |
291 return permissions_data_->HasAPIPermission(permission); | |
292 } | |
293 | |
294 bool Extension::HasAPIPermission(const std::string& permission_name) const { | |
295 return permissions_data_->HasAPIPermission(permission_name); | |
296 } | |
297 | |
298 scoped_refptr<const PermissionSet> Extension::GetActivePermissions() const { | |
299 return permissions_data_->active_permissions(); | |
300 } | |
301 | |
302 bool Extension::ShowConfigureContextMenus() const { | 289 bool Extension::ShowConfigureContextMenus() const { |
303 // Don't show context menu for component extensions. We might want to show | 290 // Don't show context menu for component extensions. We might want to show |
304 // options for component extension button but now there is no component | 291 // options for component extension button but now there is no component |
305 // extension with options. All other menu items like uninstall have | 292 // extension with options. All other menu items like uninstall have |
306 // no sense for component extensions. | 293 // no sense for component extensions. |
307 return location() != Manifest::COMPONENT && | 294 return location() != Manifest::COMPONENT && |
308 location() != Manifest::EXTERNAL_COMPONENT; | 295 location() != Manifest::EXTERNAL_COMPONENT; |
309 } | 296 } |
310 | 297 |
311 bool Extension::OverlapsWithOrigin(const GURL& origin) const { | 298 bool Extension::OverlapsWithOrigin(const GURL& origin) const { |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 | 775 |
789 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 776 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
790 const Extension* extension, | 777 const Extension* extension, |
791 const PermissionSet* permissions, | 778 const PermissionSet* permissions, |
792 Reason reason) | 779 Reason reason) |
793 : reason(reason), | 780 : reason(reason), |
794 extension(extension), | 781 extension(extension), |
795 permissions(permissions) {} | 782 permissions(permissions) {} |
796 | 783 |
797 } // namespace extensions | 784 } // namespace extensions |
OLD | NEW |