| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser/pepper_permission_util.h" | 5 #include "chrome/browser/pepper_permission_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const std::string host = url.host(); | 49 const std::string host = url.host(); |
| 50 if (url.SchemeIs(extensions::kExtensionScheme) && | 50 if (url.SchemeIs(extensions::kExtensionScheme) && |
| 51 HostIsInSet(host, whitelist)) { | 51 HostIsInSet(host, whitelist)) { |
| 52 return true; | 52 return true; |
| 53 } | 53 } |
| 54 | 54 |
| 55 const Extension* extension = NULL; | 55 const Extension* extension = NULL; |
| 56 ExtensionService* extension_service = !profile ? NULL : | 56 ExtensionService* extension_service = !profile ? NULL : |
| 57 extensions::ExtensionSystem::Get(profile)->extension_service(); | 57 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 58 if (extension_service) { | 58 if (extension_service) { |
| 59 extension = extension_service->extensions()-> | 59 extension = extension_service->extensions()->GetExtensionOrAppByURL(url); |
| 60 GetExtensionOrAppByURL(ExtensionURLInfo(url)); | |
| 61 } | 60 } |
| 62 | 61 |
| 63 // Check the modules that are imported by this extension to see if any of them | 62 // Check the modules that are imported by this extension to see if any of them |
| 64 // is whitelisted. | 63 // is whitelisted. |
| 65 if (extension) { | 64 if (extension) { |
| 66 typedef std::vector<extensions::SharedModuleInfo::ImportInfo> | 65 typedef std::vector<extensions::SharedModuleInfo::ImportInfo> |
| 67 ImportInfoVector; | 66 ImportInfoVector; |
| 68 const ImportInfoVector& imports = | 67 const ImportInfoVector& imports = |
| 69 extensions::SharedModuleInfo::GetImports(extension); | 68 extensions::SharedModuleInfo::GetImports(extension); |
| 70 for (ImportInfoVector::const_iterator it = imports.begin(); | 69 for (ImportInfoVector::const_iterator it = imports.begin(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 94 while (t.GetNext()) { | 93 while (t.GetNext()) { |
| 95 if (t.token() == host) | 94 if (t.token() == host) |
| 96 return true; | 95 return true; |
| 97 } | 96 } |
| 98 } | 97 } |
| 99 | 98 |
| 100 return false; | 99 return false; |
| 101 } | 100 } |
| 102 | 101 |
| 103 } // namespace chrome | 102 } // namespace chrome |
| OLD | NEW |