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

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

Issue 6711024: Example of how to interpose yourself in a message stream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/common/child_process_logging.h" 15 #include "chrome/common/child_process_logging.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/external_ipc_fuzzer.h"
18 #include "chrome/common/extensions/extension.h" 19 #include "chrome/common/extensions/extension.h"
19 #include "chrome/common/extensions/extension_constants.h" 20 #include "chrome/common/extensions/extension_constants.h"
20 #include "chrome/common/extensions/extension_set.h" 21 #include "chrome/common/extensions/extension_set.h"
21 #include "chrome/common/jstemplate_builder.h" 22 #include "chrome/common/jstemplate_builder.h"
22 #include "chrome/common/render_messages.h" 23 #include "chrome/common/render_messages.h"
23 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
24 #include "chrome/renderer/autofill/autofill_agent.h" 25 #include "chrome/renderer/autofill/autofill_agent.h"
25 #include "chrome/renderer/autofill/form_manager.h" 26 #include "chrome/renderer/autofill/form_manager.h"
26 #include "chrome/renderer/autofill/password_autofill_manager.h" 27 #include "chrome/renderer/autofill/password_autofill_manager.h"
27 #include "chrome/renderer/automation/automation_renderer_helper.h" 28 #include "chrome/renderer/automation/automation_renderer_helper.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 v8::Extension* search_extension = extensions_v8::SearchExtension::Get(); 156 v8::Extension* search_extension = extensions_v8::SearchExtension::Get();
156 // search_extension is null if not enabled. 157 // search_extension is null if not enabled.
157 if (search_extension) 158 if (search_extension)
158 thread->RegisterExtension(search_extension); 159 thread->RegisterExtension(search_extension);
159 160
160 if (CommandLine::ForCurrentProcess()->HasSwitch( 161 if (CommandLine::ForCurrentProcess()->HasSwitch(
161 switches::kDomAutomationController)) { 162 switches::kDomAutomationController)) {
162 thread->RegisterExtension(DomAutomationV8Extension::Get()); 163 thread->RegisterExtension(DomAutomationV8Extension::Get());
163 } 164 }
164 165
166 if (CommandLine::ForCurrentProcess()->HasSwitch(
167 switches::kEnableIPCFuzzing)) {
168 thread->SetOutgoingMessageFilter(LoadExternalIPCFuzzer());
169 }
165 // chrome: pages should not be accessible by normal content, and should 170 // chrome: pages should not be accessible by normal content, and should
166 // also be unable to script anything but themselves (to help limit the damage 171 // also be unable to script anything but themselves (to help limit the damage
167 // that a corrupt chrome: page could cause). 172 // that a corrupt chrome: page could cause).
168 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); 173 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme));
169 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); 174 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme);
170 175
171 // chrome-extension: resources shouldn't trigger insecure content warnings. 176 // chrome-extension: resources shouldn't trigger insecure content warnings.
172 WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme)); 177 WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme));
173 WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); 178 WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme);
174 } 179 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 if (old_url.is_empty() && frame->opener()) 548 if (old_url.is_empty() && frame->opener())
544 old_url = frame->opener()->url(); 549 old_url = frame->opener()->url();
545 550
546 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && 551 bool old_url_is_hosted_app = extensions->GetByURL(old_url) &&
547 !extensions->GetByURL(old_url)->web_extent().is_empty(); 552 !extensions->GetByURL(old_url)->web_extent().is_empty();
548 return !extensions->InSameExtent(old_url, new_url) && 553 return !extensions->InSameExtent(old_url, new_url) &&
549 !old_url_is_hosted_app; 554 !old_url_is_hosted_app;
550 } 555 }
551 556
552 } // namespace chrome 557 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698