| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 command_line->HasSwitch(switches::kRecordMode) || | 287 command_line->HasSwitch(switches::kRecordMode) || |
| 288 command_line->HasSwitch(switches::kNoJsRandomness)) { | 288 command_line->HasSwitch(switches::kNoJsRandomness)) { |
| 289 thread->RegisterExtension(extensions_v8::PlaybackExtension::Get()); | 289 thread->RegisterExtension(extensions_v8::PlaybackExtension::Get()); |
| 290 } | 290 } |
| 291 | 291 |
| 292 // TODO(guohui): needs to forward the new-profile-management switch to | 292 // TODO(guohui): needs to forward the new-profile-management switch to |
| 293 // renderer processes. | 293 // renderer processes. |
| 294 if (switches::IsNewProfileManagement()) | 294 if (switches::IsNewProfileManagement()) |
| 295 thread->RegisterExtension(extensions_v8::PrincipalsExtension::Get()); | 295 thread->RegisterExtension(extensions_v8::PrincipalsExtension::Get()); |
| 296 | 296 |
| 297 // chrome:, chrome-search:, and chrome-devtools: pages should not be | 297 // chrome:, chrome-search:, chrome-devtools:, and chrome-distiller: pages |
| 298 // accessible by normal content, and should also be unable to script anything | 298 // should not be accessible by normal content, and should also be unable to |
| 299 // but themselves (to help limit the damage that a corrupt page could cause). | 299 // script anything but themselves (to help limit the damage that a corrupt |
| 300 // page could cause). |
| 300 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); | 301 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); |
| 301 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); | 302 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); |
| 302 | 303 |
| 303 WebString chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme)); | 304 WebString chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme)); |
| 304 // The Instant process can only display the content but not read it. Other | 305 // The Instant process can only display the content but not read it. Other |
| 305 // processes can't display it or read it. | 306 // processes can't display it or read it. |
| 306 if (!command_line->HasSwitch(switches::kInstantProcess)) | 307 if (!command_line->HasSwitch(switches::kInstantProcess)) |
| 307 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_search_scheme); | 308 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_search_scheme); |
| 308 | 309 |
| 309 WebString dev_tools_scheme(ASCIIToUTF16(chrome::kChromeDevToolsScheme)); | 310 WebString dev_tools_scheme(ASCIIToUTF16(chrome::kChromeDevToolsScheme)); |
| 310 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(dev_tools_scheme); | 311 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(dev_tools_scheme); |
| 311 | 312 |
| 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 |
| 312 #if defined(OS_CHROMEOS) | 317 #if defined(OS_CHROMEOS) |
| 313 WebString drive_scheme(ASCIIToUTF16(chrome::kDriveScheme)); | 318 WebString drive_scheme(ASCIIToUTF16(chrome::kDriveScheme)); |
| 314 WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme); | 319 WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme); |
| 315 #endif | 320 #endif |
| 316 | 321 |
| 317 // chrome: and chrome-search: pages should not be accessible by bookmarklets | 322 // chrome: and chrome-search: pages should not be accessible by bookmarklets |
| 318 // or javascript: URLs typed in the omnibox. | 323 // or javascript: URLs typed in the omnibox. |
| 319 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( | 324 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( |
| 320 chrome_ui_scheme); | 325 chrome_ui_scheme); |
| 321 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( | 326 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1395 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1391 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); | 1396 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); |
| 1392 } | 1397 } |
| 1393 | 1398 |
| 1394 blink::WebWorkerPermissionClientProxy* | 1399 blink::WebWorkerPermissionClientProxy* |
| 1395 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1400 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
| 1396 content::RenderFrame* render_frame, | 1401 content::RenderFrame* render_frame, |
| 1397 blink::WebFrame* frame) { | 1402 blink::WebFrame* frame) { |
| 1398 return new WorkerPermissionClientProxy(render_frame, frame); | 1403 return new WorkerPermissionClientProxy(render_frame, frame); |
| 1399 } | 1404 } |
| OLD | NEW |