| 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 "chrome/common/extensions/permissions/permissions_data.h" | 5 #include "chrome/common/extensions/permissions/permissions_data.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/common/extensions/extension_manifest_constants.h" | 16 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 17 #include "chrome/common/extensions/features/base_feature_provider.h" | 17 #include "chrome/common/extensions/features/base_feature_provider.h" |
| 18 #include "chrome/common/extensions/features/feature.h" | 18 #include "chrome/common/extensions/features/feature.h" |
| 19 #include "chrome/common/extensions/manifest.h" | 19 #include "chrome/common/extensions/manifest.h" |
| 20 #include "chrome/common/extensions/permissions/api_permission_set.h" | 20 #include "chrome/common/extensions/permissions/api_permission_set.h" |
| 21 #include "chrome/common/extensions/permissions/chrome_scheme_hosts.h" | 21 #include "chrome/common/extensions/permissions/chrome_scheme_hosts.h" |
| 22 #include "chrome/common/extensions/permissions/permission_set.h" | 22 #include "chrome/common/extensions/permissions/permission_set.h" |
| 23 #include "chrome/common/extensions/permissions/permissions_info.h" | 23 #include "chrome/common/extensions/permissions/permissions_info.h" |
| 24 #include "chrome/common/extensions/user_script.h" | |
| 25 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
| 26 #include "extensions/common/constants.h" | 25 #include "extensions/common/constants.h" |
| 27 #include "extensions/common/error_utils.h" | 26 #include "extensions/common/error_utils.h" |
| 27 #include "extensions/common/switches.h" |
| 28 #include "extensions/common/url_pattern_set.h" | 28 #include "extensions/common/url_pattern_set.h" |
| 29 #include "extensions/common/user_script.h" |
| 29 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 30 | 31 |
| 31 namespace keys = extension_manifest_keys; | 32 namespace keys = extension_manifest_keys; |
| 32 namespace errors = extension_manifest_errors; | 33 namespace errors = extension_manifest_errors; |
| 33 | 34 |
| 34 namespace extensions { | 35 namespace extensions { |
| 35 | 36 |
| 36 namespace { | 37 namespace { |
| 37 | 38 |
| 38 PermissionsData::PolicyDelegate* g_policy_delegate = NULL; | 39 PermissionsData::PolicyDelegate* g_policy_delegate = NULL; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 52 return false; | 53 return false; |
| 53 } | 54 } |
| 54 | 55 |
| 55 // Custom checks for the experimental permission that can't be expressed in | 56 // Custom checks for the experimental permission that can't be expressed in |
| 56 // _permission_features.json. | 57 // _permission_features.json. |
| 57 bool CanSpecifyExperimentalPermission(const Extension* extension) { | 58 bool CanSpecifyExperimentalPermission(const Extension* extension) { |
| 58 if (extension->location() == Manifest::COMPONENT) | 59 if (extension->location() == Manifest::COMPONENT) |
| 59 return true; | 60 return true; |
| 60 | 61 |
| 61 if (CommandLine::ForCurrentProcess()->HasSwitch( | 62 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 62 switches::kEnableExperimentalExtensionApis)) { | 63 ::switches::kEnableExperimentalExtensionApis)) { |
| 63 return true; | 64 return true; |
| 64 } | 65 } |
| 65 | 66 |
| 66 // We rely on the webstore to check access to experimental. This way we can | 67 // We rely on the webstore to check access to experimental. This way we can |
| 67 // whitelist extensions to have access to experimental in just the store, and | 68 // whitelist extensions to have access to experimental in just the store, and |
| 68 // not have to push a new version of the client. | 69 // not have to push a new version of the client. |
| 69 if (extension->from_webstore()) | 70 if (extension->from_webstore()) |
| 70 return true; | 71 return true; |
| 71 | 72 |
| 72 return false; | 73 return false; |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 optional_permission_set_ = new PermissionSet( | 634 optional_permission_set_ = new PermissionSet( |
| 634 initial_optional_permissions_->api_permissions, | 635 initial_optional_permissions_->api_permissions, |
| 635 initial_optional_permissions_->host_permissions, | 636 initial_optional_permissions_->host_permissions, |
| 636 URLPatternSet()); | 637 URLPatternSet()); |
| 637 | 638 |
| 638 initial_required_permissions_.reset(); | 639 initial_required_permissions_.reset(); |
| 639 initial_optional_permissions_.reset(); | 640 initial_optional_permissions_.reset(); |
| 640 } | 641 } |
| 641 | 642 |
| 642 } // namespace extensions | 643 } // namespace extensions |
| OLD | NEW |