| 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" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/common/chrome_content_client.h" | 16 #include "chrome/common/chrome_content_client.h" |
| 17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/content_settings_pattern.h" | 19 #include "chrome/common/content_settings_pattern.h" |
| 20 #include "chrome/common/crash_keys.h" | 20 #include "chrome/common/crash_keys.h" |
| 21 #include "chrome/common/extensions/chrome_extensions_client.h" | 21 #include "chrome/common/extensions/chrome_extensions_client.h" |
| 22 #include "chrome/common/extensions/extension_constants.h" | 22 #include "chrome/common/extensions/extension_constants.h" |
| 23 #include "chrome/common/extensions/extension_process_policy.h" | 23 #include "chrome/common/extensions/extension_process_policy.h" |
| 24 #include "chrome/common/extensions/extension_set.h" | |
| 25 #include "chrome/common/localized_error.h" | 24 #include "chrome/common/localized_error.h" |
| 26 #include "chrome/common/pepper_permission_util.h" | 25 #include "chrome/common/pepper_permission_util.h" |
| 27 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
| 28 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/renderer/benchmarking_extension.h" | 28 #include "chrome/renderer/benchmarking_extension.h" |
| 30 #include "chrome/renderer/chrome_render_frame_observer.h" | 29 #include "chrome/renderer/chrome_render_frame_observer.h" |
| 31 #include "chrome/renderer/chrome_render_process_observer.h" | 30 #include "chrome/renderer/chrome_render_process_observer.h" |
| 32 #include "chrome/renderer/chrome_render_view_observer.h" | 31 #include "chrome/renderer/chrome_render_view_observer.h" |
| 33 #include "chrome/renderer/content_settings_observer.h" | 32 #include "chrome/renderer/content_settings_observer.h" |
| 34 #include "chrome/renderer/extensions/chrome_v8_context.h" | 33 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 #include "components/nacl/renderer/ppb_nacl_private_impl.h" | 70 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
| 72 #include "components/plugins/renderer/mobile_youtube_plugin.h" | 71 #include "components/plugins/renderer/mobile_youtube_plugin.h" |
| 73 #include "components/visitedlink/renderer/visitedlink_slave.h" | 72 #include "components/visitedlink/renderer/visitedlink_slave.h" |
| 74 #include "content/public/common/content_constants.h" | 73 #include "content/public/common/content_constants.h" |
| 75 #include "content/public/renderer/render_frame.h" | 74 #include "content/public/renderer/render_frame.h" |
| 76 #include "content/public/renderer/render_thread.h" | 75 #include "content/public/renderer/render_thread.h" |
| 77 #include "content/public/renderer/render_view.h" | 76 #include "content/public/renderer/render_view.h" |
| 78 #include "content/public/renderer/render_view_visitor.h" | 77 #include "content/public/renderer/render_view_visitor.h" |
| 79 #include "extensions/common/constants.h" | 78 #include "extensions/common/constants.h" |
| 80 #include "extensions/common/extension.h" | 79 #include "extensions/common/extension.h" |
| 80 #include "extensions/common/extension_set.h" |
| 81 #include "extensions/common/extension_urls.h" | 81 #include "extensions/common/extension_urls.h" |
| 82 #include "grit/generated_resources.h" | 82 #include "grit/generated_resources.h" |
| 83 #include "grit/locale_settings.h" | 83 #include "grit/locale_settings.h" |
| 84 #include "grit/renderer_resources.h" | 84 #include "grit/renderer_resources.h" |
| 85 #include "ipc/ipc_sync_channel.h" | 85 #include "ipc/ipc_sync_channel.h" |
| 86 #include "net/base/net_errors.h" | 86 #include "net/base/net_errors.h" |
| 87 #include "ppapi/c/private/ppb_nacl_private.h" | 87 #include "ppapi/c/private/ppb_nacl_private.h" |
| 88 #include "ppapi/c/private/ppb_pdf.h" | 88 #include "ppapi/c/private/ppb_pdf.h" |
| 89 #include "ppapi/shared_impl/ppapi_switches.h" | 89 #include "ppapi/shared_impl/ppapi_switches.h" |
| 90 #include "third_party/WebKit/public/platform/WebURL.h" | 90 #include "third_party/WebKit/public/platform/WebURL.h" |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 // If |url| matches one of the prerendered URLs, stop this navigation and try | 1046 // If |url| matches one of the prerendered URLs, stop this navigation and try |
| 1047 // to swap in the prerendered page on the browser process. If the prerendered | 1047 // to swap in the prerendered page on the browser process. If the prerendered |
| 1048 // page no longer exists by the time the OpenURL IPC is handled, a normal | 1048 // page no longer exists by the time the OpenURL IPC is handled, a normal |
| 1049 // navigation is attempted. | 1049 // navigation is attempted. |
| 1050 if (prerender_dispatcher_.get() && | 1050 if (prerender_dispatcher_.get() && |
| 1051 prerender_dispatcher_->IsPrerenderURL(url)) { | 1051 prerender_dispatcher_->IsPrerenderURL(url)) { |
| 1052 *send_referrer = true; | 1052 *send_referrer = true; |
| 1053 return true; | 1053 return true; |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 const ExtensionSet* extensions = extension_dispatcher_->extensions(); | 1056 const extensions::ExtensionSet* extensions = |
| 1057 extension_dispatcher_->extensions(); |
| 1057 | 1058 |
| 1058 // Determine if the new URL is an extension (excluding bookmark apps). | 1059 // Determine if the new URL is an extension (excluding bookmark apps). |
| 1059 const Extension* new_url_extension = extensions::GetNonBookmarkAppExtension( | 1060 const Extension* new_url_extension = extensions::GetNonBookmarkAppExtension( |
| 1060 *extensions, url); | 1061 *extensions, url); |
| 1061 bool is_extension_url = !!new_url_extension; | 1062 bool is_extension_url = !!new_url_extension; |
| 1062 | 1063 |
| 1063 // If the navigation would cross an app extent boundary, we also need | 1064 // If the navigation would cross an app extent boundary, we also need |
| 1064 // to defer to the browser to ensure process isolation. This is not necessary | 1065 // to defer to the browser to ensure process isolation. This is not necessary |
| 1065 // for server redirects, which will be transferred to a new process by the | 1066 // for server redirects, which will be transferred to a new process by the |
| 1066 // browser process when they are ready to commit. It is necessary for client | 1067 // browser process when they are ready to commit. It is necessary for client |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 extensions::Dispatcher* extension_dispatcher) { | 1212 extensions::Dispatcher* extension_dispatcher) { |
| 1212 extension_dispatcher_.reset(extension_dispatcher); | 1213 extension_dispatcher_.reset(extension_dispatcher); |
| 1213 permissions_policy_delegate_.reset( | 1214 permissions_policy_delegate_.reset( |
| 1214 new extensions::RendererPermissionsPolicyDelegate( | 1215 new extensions::RendererPermissionsPolicyDelegate( |
| 1215 extension_dispatcher_.get())); | 1216 extension_dispatcher_.get())); |
| 1216 } | 1217 } |
| 1217 | 1218 |
| 1218 bool ChromeContentRendererClient::CrossesExtensionExtents( | 1219 bool ChromeContentRendererClient::CrossesExtensionExtents( |
| 1219 WebFrame* frame, | 1220 WebFrame* frame, |
| 1220 const GURL& new_url, | 1221 const GURL& new_url, |
| 1221 const ExtensionSet& extensions, | 1222 const extensions::ExtensionSet& extensions, |
| 1222 bool is_extension_url, | 1223 bool is_extension_url, |
| 1223 bool is_initial_navigation) { | 1224 bool is_initial_navigation) { |
| 1224 GURL old_url(frame->top()->document().url()); | 1225 GURL old_url(frame->top()->document().url()); |
| 1225 | 1226 |
| 1226 // If old_url is still empty and this is an initial navigation, then this is | 1227 // If old_url is still empty and this is an initial navigation, then this is |
| 1227 // a window.open operation. We should look at the opener URL. | 1228 // a window.open operation. We should look at the opener URL. |
| 1228 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { | 1229 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { |
| 1229 // If we're about to open a normal web page from a same-origin opener stuck | 1230 // If we're about to open a normal web page from a same-origin opener stuck |
| 1230 // in an extension process, we want to keep it in process to allow the | 1231 // in an extension process, we want to keep it in process to allow the |
| 1231 // opener to script it. | 1232 // opener to script it. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1394 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1394 return !command_line->HasSwitch(switches::kExtensionProcess); | 1395 return !command_line->HasSwitch(switches::kExtensionProcess); |
| 1395 } | 1396 } |
| 1396 | 1397 |
| 1397 blink::WebWorkerPermissionClientProxy* | 1398 blink::WebWorkerPermissionClientProxy* |
| 1398 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1399 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
| 1399 content::RenderView* render_view, | 1400 content::RenderView* render_view, |
| 1400 blink::WebFrame* frame) { | 1401 blink::WebFrame* frame) { |
| 1401 return new WorkerPermissionClientProxy(render_view, frame); | 1402 return new WorkerPermissionClientProxy(render_view, frame); |
| 1402 } | 1403 } |
| OLD | NEW |