OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/manifest_handlers/permissions_parser.h" | 5 #include "extensions/common/manifest_handlers/permissions_parser.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 URLPatternSet chrome_scheme_hosts = | 56 URLPatternSet chrome_scheme_hosts = |
57 ExtensionsClient::Get()->GetPermittedChromeSchemeHosts(extension, | 57 ExtensionsClient::Get()->GetPermittedChromeSchemeHosts(extension, |
58 permissions); | 58 permissions); |
59 if (chrome_scheme_hosts.ContainsPattern(pattern)) | 59 if (chrome_scheme_hosts.ContainsPattern(pattern)) |
60 return true; | 60 return true; |
61 | 61 |
62 // Component extensions can have access to all of chrome://*. | 62 // Component extensions can have access to all of chrome://*. |
63 if (PermissionsData::CanExecuteScriptEverywhere(extension)) | 63 if (PermissionsData::CanExecuteScriptEverywhere(extension)) |
64 return true; | 64 return true; |
65 | 65 |
66 if (CommandLine::ForCurrentProcess()->HasSwitch( | 66 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
67 switches::kExtensionsOnChromeURLs)) { | 67 switches::kExtensionsOnChromeURLs)) { |
68 return true; | 68 return true; |
69 } | 69 } |
70 | 70 |
71 // TODO(aboxhall): return from_webstore() when webstore handles blocking | 71 // TODO(aboxhall): return from_webstore() when webstore handles blocking |
72 // extensions which request chrome:// urls | 72 // extensions which request chrome:// urls |
73 return false; | 73 return false; |
74 } | 74 } |
75 | 75 |
76 // Otherwise, the valid schemes were handled by URLPattern. | 76 // Otherwise, the valid schemes were handled by URLPattern. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // static | 331 // static |
332 scoped_refptr<const PermissionSet> PermissionsParser::GetOptionalPermissions( | 332 scoped_refptr<const PermissionSet> PermissionsParser::GetOptionalPermissions( |
333 const Extension* extension) { | 333 const Extension* extension) { |
334 DCHECK(extension->GetManifestData(keys::kOptionalPermissions)); | 334 DCHECK(extension->GetManifestData(keys::kOptionalPermissions)); |
335 return static_cast<const ManifestPermissions*>( | 335 return static_cast<const ManifestPermissions*>( |
336 extension->GetManifestData(keys::kOptionalPermissions)) | 336 extension->GetManifestData(keys::kOptionalPermissions)) |
337 ->permissions; | 337 ->permissions; |
338 } | 338 } |
339 | 339 |
340 } // namespace extensions | 340 } // namespace extensions |
OLD | NEW |