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" | |
15 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
16 #include "chrome/common/extensions/extension_manifest_constants.h" | 15 #include "chrome/common/extensions/extension_manifest_constants.h" |
17 #include "chrome/common/extensions/features/base_feature_provider.h" | 16 #include "chrome/common/extensions/features/base_feature_provider.h" |
18 #include "chrome/common/extensions/features/feature.h" | 17 #include "chrome/common/extensions/features/feature.h" |
19 #include "chrome/common/extensions/manifest.h" | 18 #include "chrome/common/extensions/manifest.h" |
20 #include "chrome/common/extensions/permissions/api_permission_set.h" | 19 #include "chrome/common/extensions/permissions/api_permission_set.h" |
21 #include "chrome/common/extensions/permissions/chrome_scheme_hosts.h" | 20 #include "chrome/common/extensions/permissions/chrome_scheme_hosts.h" |
22 #include "chrome/common/extensions/permissions/permission_set.h" | 21 #include "chrome/common/extensions/permissions/permission_set.h" |
23 #include "chrome/common/extensions/permissions/permissions_info.h" | 22 #include "chrome/common/extensions/permissions/permissions_info.h" |
24 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
(...skipping 28 matching lines...) Expand all Loading... |
53 return false; | 52 return false; |
54 } | 53 } |
55 | 54 |
56 // Custom checks for the experimental permission that can't be expressed in | 55 // Custom checks for the experimental permission that can't be expressed in |
57 // _permission_features.json. | 56 // _permission_features.json. |
58 bool CanSpecifyExperimentalPermission(const Extension* extension) { | 57 bool CanSpecifyExperimentalPermission(const Extension* extension) { |
59 if (extension->location() == Manifest::COMPONENT) | 58 if (extension->location() == Manifest::COMPONENT) |
60 return true; | 59 return true; |
61 | 60 |
62 if (CommandLine::ForCurrentProcess()->HasSwitch( | 61 if (CommandLine::ForCurrentProcess()->HasSwitch( |
63 ::switches::kEnableExperimentalExtensionApis)) { | 62 switches::kEnableExperimentalExtensionApis)) { |
64 return true; | 63 return true; |
65 } | 64 } |
66 | 65 |
67 // We rely on the webstore to check access to experimental. This way we can | 66 // We rely on the webstore to check access to experimental. This way we can |
68 // whitelist extensions to have access to experimental in just the store, and | 67 // whitelist extensions to have access to experimental in just the store, and |
69 // not have to push a new version of the client. | 68 // not have to push a new version of the client. |
70 if (extension->from_webstore()) | 69 if (extension->from_webstore()) |
71 return true; | 70 return true; |
72 | 71 |
73 return false; | 72 return false; |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 optional_permission_set_ = new PermissionSet( | 634 optional_permission_set_ = new PermissionSet( |
636 initial_optional_permissions_->api_permissions, | 635 initial_optional_permissions_->api_permissions, |
637 initial_optional_permissions_->host_permissions, | 636 initial_optional_permissions_->host_permissions, |
638 URLPatternSet()); | 637 URLPatternSet()); |
639 | 638 |
640 initial_required_permissions_.reset(); | 639 initial_required_permissions_.reset(); |
641 initial_optional_permissions_.reset(); | 640 initial_optional_permissions_.reset(); |
642 } | 641 } |
643 | 642 |
644 } // namespace extensions | 643 } // namespace extensions |
OLD | NEW |