| Index: chrome/browser/chrome_content_browser_client.cc
|
| diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
| index 5a898a9a27de3fdaa886864d8837ee019cecb781..9867e8f410008a0dc286beaad7c7af813c904fae 100644
|
| --- a/chrome/browser/chrome_content_browser_client.cc
|
| +++ b/chrome/browser/chrome_content_browser_client.cc
|
| @@ -1424,9 +1424,28 @@ std::string ChromeContentBrowserClient::GetDefaultDownloadName() {
|
| return l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME);
|
| }
|
|
|
| -bool ChromeContentBrowserClient::AllowSocketAPI(const GURL& url) {
|
| - return url.is_valid() &&
|
| - allowed_socket_origins_.find(url.host()) != allowed_socket_origins_.end();
|
| +bool ChromeContentBrowserClient::AllowSocketAPI(
|
| + content::BrowserContext* browser_context, const GURL& url) {
|
| + if (!url.is_valid())
|
| + return false;
|
| +
|
| + std::string host = url.host();
|
| + if (allowed_socket_origins_.count(host))
|
| + return true;
|
| +
|
| + Profile* profile = Profile::FromBrowserContext(browser_context);
|
| + if (!profile || !profile->GetExtensionService())
|
| + return false;
|
| +
|
| + const Extension* extension = profile->GetExtensionService()->extensions()->
|
| + GetExtensionOrAppByURL(ExtensionURLInfo(url));
|
| + if (!extension)
|
| + return false;
|
| +
|
| + if (extension->HasAPIPermission(ExtensionAPIPermission::kSocket))
|
| + return true;
|
| +
|
| + return false;
|
| }
|
|
|
| #if defined(OS_POSIX) && !defined(OS_MACOSX)
|
|
|