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/permissions/permissions_data.h" | 5 #include "extensions/common/permissions/permissions_data.h" |
6 | 6 |
7 #include <algorithm> | |
8 #include <utility> | 7 #include <utility> |
9 | 8 |
10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
11 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
12 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/stl_util.h" |
13 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
14 #include "extensions/common/constants.h" | 14 #include "extensions/common/constants.h" |
15 #include "extensions/common/error_utils.h" | 15 #include "extensions/common/error_utils.h" |
16 #include "extensions/common/extension.h" | 16 #include "extensions/common/extension.h" |
17 #include "extensions/common/extensions_client.h" | 17 #include "extensions/common/extensions_client.h" |
18 #include "extensions/common/manifest.h" | 18 #include "extensions/common/manifest.h" |
19 #include "extensions/common/manifest_constants.h" | 19 #include "extensions/common/manifest_constants.h" |
20 #include "extensions/common/manifest_handlers/permissions_parser.h" | 20 #include "extensions/common/manifest_handlers/permissions_parser.h" |
21 #include "extensions/common/permissions/api_permission.h" | 21 #include "extensions/common/permissions/api_permission.h" |
22 #include "extensions/common/permissions/permission_message_provider.h" | 22 #include "extensions/common/permissions/permission_message_provider.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 // static | 79 // static |
80 bool PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) { | 80 bool PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) { |
81 if (extension->location() == Manifest::COMPONENT) | 81 if (extension->location() == Manifest::COMPONENT) |
82 return true; | 82 return true; |
83 | 83 |
84 const ExtensionsClient::ScriptingWhitelist& whitelist = | 84 const ExtensionsClient::ScriptingWhitelist& whitelist = |
85 ExtensionsClient::Get()->GetScriptingWhitelist(); | 85 ExtensionsClient::Get()->GetScriptingWhitelist(); |
86 | 86 |
87 return std::find(whitelist.begin(), whitelist.end(), extension->id()) != | 87 return base::ContainsValue(whitelist, extension->id()); |
88 whitelist.end(); | |
89 } | 88 } |
90 | 89 |
91 // static | 90 // static |
92 bool PermissionsData::ShouldSkipPermissionWarnings( | 91 bool PermissionsData::ShouldSkipPermissionWarnings( |
93 const std::string& extension_id) { | 92 const std::string& extension_id) { |
94 // See http://b/4946060 for more details. | 93 // See http://b/4946060 for more details. |
95 return extension_id == extension_misc::kProdHangoutsExtensionId; | 94 return extension_id == extension_misc::kProdHangoutsExtensionId; |
96 } | 95 } |
97 | 96 |
98 // static | 97 // static |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 manifest_errors::kCannotAccessPageWithUrl, document_url.spec()); | 455 manifest_errors::kCannotAccessPageWithUrl, document_url.spec()); |
457 } else { | 456 } else { |
458 *error = manifest_errors::kCannotAccessPage; | 457 *error = manifest_errors::kCannotAccessPage; |
459 } | 458 } |
460 } | 459 } |
461 | 460 |
462 return ACCESS_DENIED; | 461 return ACCESS_DENIED; |
463 } | 462 } |
464 | 463 |
465 } // namespace extensions | 464 } // namespace extensions |
OLD | NEW |