OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
775 base::CommandLine::ForCurrentProcess()->HasSwitch( | 775 base::CommandLine::ForCurrentProcess()->HasSwitch( |
776 switches::kEnableNaCl); | 776 switches::kEnableNaCl); |
777 } else if (is_pnacl_mime_type) { | 777 } else if (is_pnacl_mime_type) { |
778 is_nacl_unrestricted = true; | 778 is_nacl_unrestricted = true; |
779 } | 779 } |
780 GURL manifest_url; | 780 GURL manifest_url; |
781 GURL app_url; | 781 GURL app_url; |
782 if (is_nacl_mime_type || is_pnacl_mime_type) { | 782 if (is_nacl_mime_type || is_pnacl_mime_type) { |
783 // Normal NaCl/PNaCl embed. The app URL is the page URL. | 783 // Normal NaCl/PNaCl embed. The app URL is the page URL. |
784 manifest_url = url; | 784 manifest_url = url; |
785 app_url = frame->Top()->GetDocument().Url(); | 785 // TODO(lukasza, alexmos): https://crbug.com/728295: Don't assume |
786 // that the top frame is local. | |
787 app_url = frame->Top()->ToWebLocalFrame()->GetDocument().Url(); | |
Łukasz Anforowicz
2017/06/15 20:15:59
This isn't worse than the current code, right?
dcheng
2017/06/15 23:17:00
Doesn't seem worse =/
Didn't we have to "fix" thi
Łukasz Anforowicz
2017/06/16 19:39:24
Ack.
| |
786 } else { | 788 } else { |
787 // NaCl is being invoked as a content handler. Look up the NaCl | 789 // NaCl is being invoked as a content handler. Look up the NaCl |
788 // module using the MIME type. The app URL is the manifest URL. | 790 // module using the MIME type. The app URL is the manifest URL. |
789 manifest_url = GetNaClContentHandlerURL(actual_mime_type, info); | 791 manifest_url = GetNaClContentHandlerURL(actual_mime_type, info); |
790 app_url = manifest_url; | 792 app_url = manifest_url; |
791 } | 793 } |
792 const Extension* extension = | 794 const Extension* extension = |
793 extensions::RendererExtensionRegistry::Get() | 795 extensions::RendererExtensionRegistry::Get() |
794 ->GetExtensionOrAppByURL(manifest_url); | 796 ->GetExtensionOrAppByURL(manifest_url); |
795 if (!IsNaClAllowed(manifest_url, | 797 if (!IsNaClAllowed(manifest_url, |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1360 // it's allowed to access. | 1362 // it's allowed to access. |
1361 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1363 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1362 return !IsStandaloneExtensionProcess(); | 1364 return !IsStandaloneExtensionProcess(); |
1363 #else | 1365 #else |
1364 return true; | 1366 return true; |
1365 #endif | 1367 #endif |
1366 } | 1368 } |
1367 | 1369 |
1368 std::unique_ptr<blink::WebContentSettingsClient> | 1370 std::unique_ptr<blink::WebContentSettingsClient> |
1369 ChromeContentRendererClient::CreateWorkerContentSettingsClient( | 1371 ChromeContentRendererClient::CreateWorkerContentSettingsClient( |
1370 content::RenderFrame* render_frame, | 1372 content::RenderFrame* render_frame) { |
1371 WebFrame* frame) { | 1373 return base::MakeUnique<WorkerContentSettingsClient>(render_frame); |
1372 return base::MakeUnique<WorkerContentSettingsClient>(render_frame, frame); | |
1373 } | 1374 } |
1374 | 1375 |
1375 bool ChromeContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { | 1376 bool ChromeContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { |
1376 #if BUILDFLAG(ENABLE_PLUGINS) | 1377 #if BUILDFLAG(ENABLE_PLUGINS) |
1377 // Allow access for tests. | 1378 // Allow access for tests. |
1378 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1379 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1379 switches::kEnablePepperTesting)) { | 1380 switches::kEnablePepperTesting)) { |
1380 return true; | 1381 return true; |
1381 } | 1382 } |
1382 | 1383 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1593 | 1594 |
1594 RecordYouTubeRewriteUMA(result); | 1595 RecordYouTubeRewriteUMA(result); |
1595 return corrected_url.ReplaceComponents(r); | 1596 return corrected_url.ReplaceComponents(r); |
1596 } | 1597 } |
1597 | 1598 |
1598 std::unique_ptr<base::TaskScheduler::InitParams> | 1599 std::unique_ptr<base::TaskScheduler::InitParams> |
1599 ChromeContentRendererClient::GetTaskSchedulerInitParams() { | 1600 ChromeContentRendererClient::GetTaskSchedulerInitParams() { |
1600 return task_scheduler_util:: | 1601 return task_scheduler_util:: |
1601 GetRendererTaskSchedulerInitParamsFromCommandLine(); | 1602 GetRendererTaskSchedulerInitParamsFromCommandLine(); |
1602 } | 1603 } |
OLD | NEW |