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