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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "content/common/child_process_messages.h" | 82 #include "content/common/child_process_messages.h" |
83 #include "content/common/gpu/gpu_messages.h" | 83 #include "content/common/gpu/gpu_messages.h" |
84 #include "content/common/resource_messages.h" | 84 #include "content/common/resource_messages.h" |
85 #include "content/common/view_messages.h" | 85 #include "content/common/view_messages.h" |
86 #include "content/public/browser/browser_context.h" | 86 #include "content/public/browser/browser_context.h" |
87 #include "content/public/browser/content_browser_client.h" | 87 #include "content/public/browser/content_browser_client.h" |
88 #include "content/public/browser/notification_service.h" | 88 #include "content/public/browser/notification_service.h" |
89 #include "content/public/browser/notification_service.h" | 89 #include "content/public/browser/notification_service.h" |
90 #include "content/public/browser/render_view_host_delegate.h" | 90 #include "content/public/browser/render_view_host_delegate.h" |
91 #include "content/public/browser/user_metrics.h" | 91 #include "content/public/browser/user_metrics.h" |
92 #include "content/public/browser/web_ui_factory.h" | 92 #include "content/public/browser/web_ui_controller_factory.h" |
93 #include "content/public/common/content_constants.h" | 93 #include "content/public/common/content_constants.h" |
94 #include "content/public/common/content_switches.h" | 94 #include "content/public/common/content_switches.h" |
95 #include "content/public/common/process_type.h" | 95 #include "content/public/common/process_type.h" |
96 #include "content/public/common/result_codes.h" | 96 #include "content/public/common/result_codes.h" |
97 #include "content/renderer/render_process_impl.h" | 97 #include "content/renderer/render_process_impl.h" |
98 #include "content/renderer/render_thread_impl.h" | 98 #include "content/renderer/render_thread_impl.h" |
99 #include "ipc/ipc_logging.h" | 99 #include "ipc/ipc_logging.h" |
100 #include "ipc/ipc_platform_file.h" | 100 #include "ipc/ipc_platform_file.h" |
101 #include "ipc/ipc_switches.h" | 101 #include "ipc/ipc_switches.h" |
102 #include "media/base/media_switches.h" | 102 #include "media/base/media_switches.h" |
103 #include "net/url_request/url_request_context_getter.h" | 103 #include "net/url_request/url_request_context_getter.h" |
104 #include "ui/base/ui_base_switches.h" | 104 #include "ui/base/ui_base_switches.h" |
105 #include "ui/gfx/gl/gl_switches.h" | 105 #include "ui/gfx/gl/gl_switches.h" |
106 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 106 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
107 #include "webkit/glue/resource_type.h" | 107 #include "webkit/glue/resource_type.h" |
108 #include "webkit/plugins/plugin_switches.h" | 108 #include "webkit/plugins/plugin_switches.h" |
109 | 109 |
110 #if defined(OS_WIN) | 110 #if defined(OS_WIN) |
111 #include "base/synchronization/waitable_event.h" | 111 #include "base/synchronization/waitable_event.h" |
112 #include "content/common/font_cache_dispatcher_win.h" | 112 #include "content/common/font_cache_dispatcher_win.h" |
113 #endif | 113 #endif |
114 | 114 |
115 #include "third_party/skia/include/core/SkBitmap.h" | 115 #include "third_party/skia/include/core/SkBitmap.h" |
116 | 116 |
117 using content::BrowserMessageFilter; | 117 using content::BrowserMessageFilter; |
118 using content::BrowserThread; | 118 using content::BrowserThread; |
119 using content::ChildProcessHost; | 119 using content::ChildProcessHost; |
120 using content::ChildProcessHostImpl; | 120 using content::ChildProcessHostImpl; |
121 using content::UserMetricsAction; | 121 using content::UserMetricsAction; |
| 122 using content::WebUIControllerFactory; |
122 | 123 |
123 // This class creates the IO thread for the renderer when running in | 124 // This class creates the IO thread for the renderer when running in |
124 // single-process mode. It's not used in multi-process mode. | 125 // single-process mode. It's not used in multi-process mode. |
125 class RendererMainThread : public base::Thread { | 126 class RendererMainThread : public base::Thread { |
126 public: | 127 public: |
127 explicit RendererMainThread(const std::string& channel_id) | 128 explicit RendererMainThread(const std::string& channel_id) |
128 : base::Thread("Chrome_InProcRendererThread"), | 129 : base::Thread("Chrome_InProcRendererThread"), |
129 channel_id_(channel_id), | 130 channel_id_(channel_id), |
130 render_process_(NULL) { | 131 render_process_(NULL) { |
131 } | 132 } |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 bool RenderProcessHostImpl::IsSuitableHost( | 1086 bool RenderProcessHostImpl::IsSuitableHost( |
1086 content::RenderProcessHost* host, | 1087 content::RenderProcessHost* host, |
1087 content::BrowserContext* browser_context, | 1088 content::BrowserContext* browser_context, |
1088 const GURL& site_url) { | 1089 const GURL& site_url) { |
1089 if (run_renderer_in_process()) | 1090 if (run_renderer_in_process()) |
1090 return true; | 1091 return true; |
1091 | 1092 |
1092 if (host->GetBrowserContext() != browser_context) | 1093 if (host->GetBrowserContext() != browser_context) |
1093 return false; | 1094 return false; |
1094 | 1095 |
1095 if (ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings( | 1096 WebUIControllerFactory* factory = |
| 1097 content::GetContentClient()->browser()->GetWebUIControllerFactory(); |
| 1098 if (factory && |
| 1099 ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings( |
1096 host->GetID()) != | 1100 host->GetID()) != |
1097 content::GetContentClient()->browser()->GetWebUIFactory()-> | 1101 factory->UseWebUIBindingsForURL(browser_context, site_url)) { |
1098 UseWebUIBindingsForURL(browser_context, site_url)) | |
1099 return false; | 1102 return false; |
| 1103 } |
1100 | 1104 |
1101 return content::GetContentClient()->browser()->IsSuitableHost(host, site_url); | 1105 return content::GetContentClient()->browser()->IsSuitableHost(host, site_url); |
1102 } | 1106 } |
1103 | 1107 |
1104 // static | 1108 // static |
1105 bool content::RenderProcessHost::run_renderer_in_process() { | 1109 bool content::RenderProcessHost::run_renderer_in_process() { |
1106 return g_run_renderer_in_process_; | 1110 return g_run_renderer_in_process_; |
1107 } | 1111 } |
1108 | 1112 |
1109 void content::RenderProcessHost::set_run_renderer_in_process(bool value) { | 1113 void content::RenderProcessHost::set_run_renderer_in_process(bool value) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1292 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
1289 // Only honor the request if appropriate persmissions are granted. | 1293 // Only honor the request if appropriate persmissions are granted. |
1290 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1294 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
1291 content::GetContentClient()->browser()->OpenItem(path); | 1295 content::GetContentClient()->browser()->OpenItem(path); |
1292 } | 1296 } |
1293 | 1297 |
1294 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1298 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
1295 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1299 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
1296 MHTMLGenerated(job_id, data_size); | 1300 MHTMLGenerated(job_id, data_size); |
1297 } | 1301 } |
OLD | NEW |