| OLD | NEW |
| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 v8::Extension* search_extension = extensions_v8::SearchExtension::Get(); | 158 v8::Extension* search_extension = extensions_v8::SearchExtension::Get(); |
| 158 // search_extension is null if not enabled. | 159 // search_extension is null if not enabled. |
| 159 if (search_extension) | 160 if (search_extension) |
| 160 thread->RegisterExtension(search_extension); | 161 thread->RegisterExtension(search_extension); |
| 161 | 162 |
| 162 if (CommandLine::ForCurrentProcess()->HasSwitch( | 163 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 163 switches::kDomAutomationController)) { | 164 switches::kDomAutomationController)) { |
| 164 thread->RegisterExtension(DomAutomationV8Extension::Get()); | 165 thread->RegisterExtension(DomAutomationV8Extension::Get()); |
| 165 } | 166 } |
| 166 | 167 |
| 168 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 169 switches::kEnableIPCFuzzing)) { |
| 170 thread->channel()->set_outgoing_message_filter(LoadExternalIPCFuzzer()); |
| 171 } |
| 167 // chrome: pages should not be accessible by normal content, and should | 172 // chrome: pages should not be accessible by normal content, and should |
| 168 // also be unable to script anything but themselves (to help limit the damage | 173 // also be unable to script anything but themselves (to help limit the damage |
| 169 // that a corrupt chrome: page could cause). | 174 // that a corrupt chrome: page could cause). |
| 170 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); | 175 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); |
| 171 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); | 176 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); |
| 172 | 177 |
| 173 // chrome-extension: resources shouldn't trigger insecure content warnings. | 178 // chrome-extension: resources shouldn't trigger insecure content warnings. |
| 174 WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme)); | 179 WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme)); |
| 175 WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); | 180 WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); |
| 176 } | 181 } |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 if (old_url.is_empty() && frame->opener()) | 559 if (old_url.is_empty() && frame->opener()) |
| 555 old_url = frame->opener()->url(); | 560 old_url = frame->opener()->url(); |
| 556 | 561 |
| 557 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && | 562 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && |
| 558 !extensions->GetByURL(old_url)->web_extent().is_empty(); | 563 !extensions->GetByURL(old_url)->web_extent().is_empty(); |
| 559 return !extensions->InSameExtent(old_url, new_url) && | 564 return !extensions->InSameExtent(old_url, new_url) && |
| 560 !old_url_is_hosted_app; | 565 !old_url_is_hosted_app; |
| 561 } | 566 } |
| 562 | 567 |
| 563 } // namespace chrome | 568 } // namespace chrome |
| OLD | NEW |