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 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 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 // If |url| matches one of the prerendered URLs, stop this navigation and try | 1038 // If |url| matches one of the prerendered URLs, stop this navigation and try |
1039 // to swap in the prerendered page on the browser process. If the prerendered | 1039 // to swap in the prerendered page on the browser process. If the prerendered |
1040 // page no longer exists by the time the OpenURL IPC is handled, a normal | 1040 // page no longer exists by the time the OpenURL IPC is handled, a normal |
1041 // navigation is attempted. | 1041 // navigation is attempted. |
1042 if (prerender_dispatcher_.get() && | 1042 if (prerender_dispatcher_.get() && |
1043 prerender_dispatcher_->IsPrerenderURL(url)) { | 1043 prerender_dispatcher_->IsPrerenderURL(url)) { |
1044 *send_referrer = true; | 1044 *send_referrer = true; |
1045 return true; | 1045 return true; |
1046 } | 1046 } |
1047 | 1047 |
1048 const ExtensionSet* extensions = extension_dispatcher_->extensions(); | 1048 const extensions::ExtensionSet* extensions = |
| 1049 extension_dispatcher_->extensions(); |
1049 | 1050 |
1050 // Determine if the new URL is an extension (excluding bookmark apps). | 1051 // Determine if the new URL is an extension (excluding bookmark apps). |
1051 const Extension* new_url_extension = extensions::GetNonBookmarkAppExtension( | 1052 const Extension* new_url_extension = extensions::GetNonBookmarkAppExtension( |
1052 *extensions, url); | 1053 *extensions, url); |
1053 bool is_extension_url = !!new_url_extension; | 1054 bool is_extension_url = !!new_url_extension; |
1054 | 1055 |
1055 // If the navigation would cross an app extent boundary, we also need | 1056 // If the navigation would cross an app extent boundary, we also need |
1056 // to defer to the browser to ensure process isolation. This is not necessary | 1057 // to defer to the browser to ensure process isolation. This is not necessary |
1057 // for server redirects, which will be transferred to a new process by the | 1058 // for server redirects, which will be transferred to a new process by the |
1058 // browser process when they are ready to commit. It is necessary for client | 1059 // 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... |
1203 extensions::Dispatcher* extension_dispatcher) { | 1204 extensions::Dispatcher* extension_dispatcher) { |
1204 extension_dispatcher_.reset(extension_dispatcher); | 1205 extension_dispatcher_.reset(extension_dispatcher); |
1205 permissions_policy_delegate_.reset( | 1206 permissions_policy_delegate_.reset( |
1206 new extensions::RendererPermissionsPolicyDelegate( | 1207 new extensions::RendererPermissionsPolicyDelegate( |
1207 extension_dispatcher_.get())); | 1208 extension_dispatcher_.get())); |
1208 } | 1209 } |
1209 | 1210 |
1210 bool ChromeContentRendererClient::CrossesExtensionExtents( | 1211 bool ChromeContentRendererClient::CrossesExtensionExtents( |
1211 WebFrame* frame, | 1212 WebFrame* frame, |
1212 const GURL& new_url, | 1213 const GURL& new_url, |
1213 const ExtensionSet& extensions, | 1214 const extensions::ExtensionSet& extensions, |
1214 bool is_extension_url, | 1215 bool is_extension_url, |
1215 bool is_initial_navigation) { | 1216 bool is_initial_navigation) { |
1216 GURL old_url(frame->top()->document().url()); | 1217 GURL old_url(frame->top()->document().url()); |
1217 | 1218 |
1218 // If old_url is still empty and this is an initial navigation, then this is | 1219 // If old_url is still empty and this is an initial navigation, then this is |
1219 // a window.open operation. We should look at the opener URL. | 1220 // a window.open operation. We should look at the opener URL. |
1220 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { | 1221 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { |
1221 // If we're about to open a normal web page from a same-origin opener stuck | 1222 // If we're about to open a normal web page from a same-origin opener stuck |
1222 // in an extension process, we want to keep it in process to allow the | 1223 // in an extension process, we want to keep it in process to allow the |
1223 // opener to script it. | 1224 // opener to script it. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1388 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1388 return !command_line->HasSwitch(switches::kExtensionProcess); | 1389 return !command_line->HasSwitch(switches::kExtensionProcess); |
1389 } | 1390 } |
1390 | 1391 |
1391 blink::WebWorkerPermissionClientProxy* | 1392 blink::WebWorkerPermissionClientProxy* |
1392 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1393 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
1393 content::RenderView* render_view, | 1394 content::RenderView* render_view, |
1394 blink::WebFrame* frame) { | 1395 blink::WebFrame* frame) { |
1395 return new WorkerPermissionClientProxy(render_view, frame); | 1396 return new WorkerPermissionClientProxy(render_view, frame); |
1396 } | 1397 } |
OLD | NEW |