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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 command_line->HasSwitch(switches::kRecordMode) || | 285 command_line->HasSwitch(switches::kRecordMode) || |
286 command_line->HasSwitch(switches::kNoJsRandomness)) { | 286 command_line->HasSwitch(switches::kNoJsRandomness)) { |
287 thread->RegisterExtension(extensions_v8::PlaybackExtension::Get()); | 287 thread->RegisterExtension(extensions_v8::PlaybackExtension::Get()); |
288 } | 288 } |
289 | 289 |
290 // TODO(guohui): needs to forward the new-profile-management switch to | 290 // TODO(guohui): needs to forward the new-profile-management switch to |
291 // renderer processes. | 291 // renderer processes. |
292 if (switches::IsNewProfileManagement()) | 292 if (switches::IsNewProfileManagement()) |
293 thread->RegisterExtension(extensions_v8::PrincipalsExtension::Get()); | 293 thread->RegisterExtension(extensions_v8::PrincipalsExtension::Get()); |
294 | 294 |
295 // chrome:, chrome-search:, and chrome-devtools: pages should not be | 295 // chrome:, chrome-search:, chrome-devtools:, and chrome-distiller: pages |
296 // accessible by normal content, and should also be unable to script anything | 296 // should not be accessible by normal content, and should also be unable to |
297 // but themselves (to help limit the damage that a corrupt page could cause). | 297 // script anything but themselves (to help limit the damage that a corrupt |
298 // page could cause). | |
298 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); | 299 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); |
299 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); | 300 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); |
300 | 301 |
301 WebString chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme)); | 302 WebString chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme)); |
302 // The Instant process can only display the content but not read it. Other | 303 // The Instant process can only display the content but not read it. Other |
303 // processes can't display it or read it. | 304 // processes can't display it or read it. |
304 if (!command_line->HasSwitch(switches::kInstantProcess)) | 305 if (!command_line->HasSwitch(switches::kInstantProcess)) |
305 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_search_scheme); | 306 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_search_scheme); |
306 | 307 |
307 WebString dev_tools_scheme(ASCIIToUTF16(chrome::kChromeDevToolsScheme)); | 308 WebString dev_tools_scheme(ASCIIToUTF16(chrome::kChromeDevToolsScheme)); |
308 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(dev_tools_scheme); | 309 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(dev_tools_scheme); |
309 | 310 |
311 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
nasko
2014/01/16 23:39:12
While this is technically correct, registering the
nyquist
2014/01/22 00:47:58
Done.
| |
312 switches::kEnableDomDistiller)) { | |
313 WebString dom_distiller_scheme(ASCIIToUTF16(chrome::kDomDistillerScheme)); | |
314 // TODO(nyquist): Add test to ensure this happens when the flag is set. | |
315 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(dom_distiller_scheme); | |
316 } | |
317 | |
310 #if defined(OS_CHROMEOS) | 318 #if defined(OS_CHROMEOS) |
311 WebString drive_scheme(ASCIIToUTF16(chrome::kDriveScheme)); | 319 WebString drive_scheme(ASCIIToUTF16(chrome::kDriveScheme)); |
312 WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme); | 320 WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme); |
313 #endif | 321 #endif |
314 | 322 |
315 // chrome: and chrome-search: pages should not be accessible by bookmarklets | 323 // chrome: and chrome-search: pages should not be accessible by bookmarklets |
316 // or javascript: URLs typed in the omnibox. | 324 // or javascript: URLs typed in the omnibox. |
317 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( | 325 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( |
318 chrome_ui_scheme); | 326 chrome_ui_scheme); |
319 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( | 327 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1382 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1390 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1383 return !command_line->HasSwitch(switches::kExtensionProcess); | 1391 return !command_line->HasSwitch(switches::kExtensionProcess); |
1384 } | 1392 } |
1385 | 1393 |
1386 blink::WebWorkerPermissionClientProxy* | 1394 blink::WebWorkerPermissionClientProxy* |
1387 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1395 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
1388 content::RenderFrame* render_frame, | 1396 content::RenderFrame* render_frame, |
1389 blink::WebFrame* frame) { | 1397 blink::WebFrame* frame) { |
1390 return new WorkerPermissionClientProxy(render_frame, frame); | 1398 return new WorkerPermissionClientProxy(render_frame, frame); |
1391 } | 1399 } |
OLD | NEW |