Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 105723002: Add the scheme chrome-distiller:// and hook up data source. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 command_line->HasSwitch(switches::kRecordMode) || 282 command_line->HasSwitch(switches::kRecordMode) ||
283 command_line->HasSwitch(switches::kNoJsRandomness)) { 283 command_line->HasSwitch(switches::kNoJsRandomness)) {
284 thread->RegisterExtension(extensions_v8::PlaybackExtension::Get()); 284 thread->RegisterExtension(extensions_v8::PlaybackExtension::Get());
285 } 285 }
286 286
287 // TODO(guohui): needs to forward the new-profile-management switch to 287 // TODO(guohui): needs to forward the new-profile-management switch to
288 // renderer processes. 288 // renderer processes.
289 if (command_line->HasSwitch(switches::kNewProfileManagement)) 289 if (command_line->HasSwitch(switches::kNewProfileManagement))
290 thread->RegisterExtension(extensions_v8::PrincipalsExtension::Get()); 290 thread->RegisterExtension(extensions_v8::PrincipalsExtension::Get());
291 291
292 // chrome:, chrome-search:, chrome-devtools:, and chrome-internal: pages 292 // chrome:, chrome-search:, chrome-devtools:, chrome-distiller: and
293 // should not be accessible by normal content, and should also be unable to 293 // chrome-internal: pages should not be accessible by normal content, and
294 // script anything but themselves (to help limit the damage that a corrupt 294 // should also be unable to script anything but themselves (to help limit the
295 // page could cause). 295 // damage that a corrupt page could cause).
296 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); 296 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme));
297 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); 297 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme);
298 298
299 WebString chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme)); 299 WebString chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme));
300 // 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
301 // processes can't display it or read it. 301 // processes can't display it or read it.
302 if (!command_line->HasSwitch(switches::kInstantProcess)) 302 if (!command_line->HasSwitch(switches::kInstantProcess))
303 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_search_scheme); 303 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_search_scheme);
304 304
305 WebString dev_tools_scheme(ASCIIToUTF16(chrome::kChromeDevToolsScheme)); 305 WebString dev_tools_scheme(ASCIIToUTF16(chrome::kChromeDevToolsScheme));
306 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(dev_tools_scheme); 306 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(dev_tools_scheme);
307 307
308 WebString internal_scheme(ASCIIToUTF16(chrome::kChromeInternalScheme)); 308 WebString internal_scheme(ASCIIToUTF16(chrome::kChromeInternalScheme));
309 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(internal_scheme); 309 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(internal_scheme);
310 310
311 if (CommandLine::ForCurrentProcess()->HasSwitch(
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
311 #if defined(OS_CHROMEOS) 318 #if defined(OS_CHROMEOS)
312 WebString drive_scheme(ASCIIToUTF16(chrome::kDriveScheme)); 319 WebString drive_scheme(ASCIIToUTF16(chrome::kDriveScheme));
313 WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme); 320 WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme);
314 #endif 321 #endif
315 322
316 // chrome: and chrome-search: pages should not be accessible by bookmarklets 323 // chrome: and chrome-search: pages should not be accessible by bookmarklets
317 // or javascript: URLs typed in the omnibox. 324 // or javascript: URLs typed in the omnibox.
318 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( 325 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs(
319 chrome_ui_scheme); 326 chrome_ui_scheme);
320 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( 327 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs(
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 CommandLine* command_line = CommandLine::ForCurrentProcess(); 1398 CommandLine* command_line = CommandLine::ForCurrentProcess();
1392 return !command_line->HasSwitch(switches::kExtensionProcess); 1399 return !command_line->HasSwitch(switches::kExtensionProcess);
1393 } 1400 }
1394 1401
1395 blink::WebWorkerPermissionClientProxy* 1402 blink::WebWorkerPermissionClientProxy*
1396 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( 1403 ChromeContentRendererClient::CreateWorkerPermissionClientProxy(
1397 content::RenderView* render_view, 1404 content::RenderView* render_view,
1398 blink::WebFrame* frame) { 1405 blink::WebFrame* frame) {
1399 return new WorkerPermissionClientProxy(render_view, frame); 1406 return new WorkerPermissionClientProxy(render_view, frame);
1400 } 1407 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698