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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 command_line->HasSwitch(switches::kRecordMode) || | 283 command_line->HasSwitch(switches::kRecordMode) || |
284 command_line->HasSwitch(switches::kNoJsRandomness)) { | 284 command_line->HasSwitch(switches::kNoJsRandomness)) { |
285 thread->RegisterExtension(extensions_v8::PlaybackExtension::Get()); | 285 thread->RegisterExtension(extensions_v8::PlaybackExtension::Get()); |
286 } | 286 } |
287 | 287 |
288 // TODO(guohui): needs to forward the new-profile-management switch to | 288 // TODO(guohui): needs to forward the new-profile-management switch to |
289 // renderer processes. | 289 // renderer processes. |
290 if (command_line->HasSwitch(switches::kNewProfileManagement)) | 290 if (command_line->HasSwitch(switches::kNewProfileManagement)) |
291 thread->RegisterExtension(extensions_v8::PrincipalsExtension::Get()); | 291 thread->RegisterExtension(extensions_v8::PrincipalsExtension::Get()); |
292 | 292 |
293 // chrome:, chrome-search:, chrome-devtools:, and chrome-internal: pages | 293 // chrome:, chrome-search:, and chrome-devtools: pages should not be |
294 // should not be accessible by normal content, and should also be unable to | 294 // accessible by normal content, and should also be unable to script anything |
295 // script anything but themselves (to help limit the damage that a corrupt | 295 // but themselves (to help limit the damage that a corrupt page could cause). |
296 // page could cause). | |
297 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); | 296 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); |
298 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); | 297 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); |
299 | 298 |
300 WebString chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme)); | 299 WebString chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme)); |
301 // The Instant process can only display the content but not read it. Other | 300 // The Instant process can only display the content but not read it. Other |
302 // processes can't display it or read it. | 301 // processes can't display it or read it. |
303 if (!command_line->HasSwitch(switches::kInstantProcess)) | 302 if (!command_line->HasSwitch(switches::kInstantProcess)) |
304 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_search_scheme); | 303 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_search_scheme); |
305 | 304 |
306 WebString dev_tools_scheme(ASCIIToUTF16(chrome::kChromeDevToolsScheme)); | 305 WebString dev_tools_scheme(ASCIIToUTF16(chrome::kChromeDevToolsScheme)); |
307 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(dev_tools_scheme); | 306 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(dev_tools_scheme); |
308 | 307 |
309 WebString internal_scheme(ASCIIToUTF16(chrome::kChromeInternalScheme)); | |
310 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(internal_scheme); | |
311 | |
312 #if defined(OS_CHROMEOS) | 308 #if defined(OS_CHROMEOS) |
313 WebString drive_scheme(ASCIIToUTF16(chrome::kDriveScheme)); | 309 WebString drive_scheme(ASCIIToUTF16(chrome::kDriveScheme)); |
314 WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme); | 310 WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme); |
315 #endif | 311 #endif |
316 | 312 |
317 // chrome: and chrome-search: pages should not be accessible by bookmarklets | 313 // chrome: and chrome-search: pages should not be accessible by bookmarklets |
318 // or javascript: URLs typed in the omnibox. | 314 // or javascript: URLs typed in the omnibox. |
319 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( | 315 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( |
320 chrome_ui_scheme); | 316 chrome_ui_scheme); |
321 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( | 317 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1376 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1381 return !command_line->HasSwitch(switches::kExtensionProcess); | 1377 return !command_line->HasSwitch(switches::kExtensionProcess); |
1382 } | 1378 } |
1383 | 1379 |
1384 blink::WebWorkerPermissionClientProxy* | 1380 blink::WebWorkerPermissionClientProxy* |
1385 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1381 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
1386 content::RenderView* render_view, | 1382 content::RenderView* render_view, |
1387 blink::WebFrame* frame) { | 1383 blink::WebFrame* frame) { |
1388 return new WorkerPermissionClientProxy(render_view, frame); | 1384 return new WorkerPermissionClientProxy(render_view, frame); |
1389 } | 1385 } |
OLD | NEW |