| 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 // 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 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "content/browser/renderer_host/render_widget_host.h" | 69 #include "content/browser/renderer_host/render_widget_host.h" |
| 70 #include "content/browser/renderer_host/resource_message_filter.h" | 70 #include "content/browser/renderer_host/resource_message_filter.h" |
| 71 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 71 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
| 72 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 72 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
| 73 #include "content/browser/resolve_proxy_msg_helper.h" | 73 #include "content/browser/resolve_proxy_msg_helper.h" |
| 74 #include "content/browser/speech/speech_input_dispatcher_host.h" | 74 #include "content/browser/speech/speech_input_dispatcher_host.h" |
| 75 #include "content/browser/trace_message_filter.h" | 75 #include "content/browser/trace_message_filter.h" |
| 76 #include "content/browser/user_metrics.h" | 76 #include "content/browser/user_metrics.h" |
| 77 #include "content/browser/webui/web_ui_factory.h" | 77 #include "content/browser/webui/web_ui_factory.h" |
| 78 #include "content/browser/worker_host/worker_message_filter.h" | 78 #include "content/browser/worker_host/worker_message_filter.h" |
| 79 #include "content/common/child_process_info.h" | 79 #include "content/common/child_process_host.h" |
| 80 #include "content/common/child_process_messages.h" | 80 #include "content/common/child_process_messages.h" |
| 81 #include "content/common/gpu/gpu_messages.h" | 81 #include "content/common/gpu/gpu_messages.h" |
| 82 #include "content/public/browser/notification_service.h" | 82 #include "content/public/browser/notification_service.h" |
| 83 #include "content/common/resource_messages.h" | 83 #include "content/common/resource_messages.h" |
| 84 #include "content/common/view_messages.h" | 84 #include "content/common/view_messages.h" |
| 85 #include "content/public/browser/content_browser_client.h" | 85 #include "content/public/browser/content_browser_client.h" |
| 86 #include "content/public/common/content_constants.h" | 86 #include "content/public/common/content_constants.h" |
| 87 #include "content/public/common/content_switches.h" | 87 #include "content/public/common/content_switches.h" |
| 88 #include "content/public/common/process_type.h" | 88 #include "content/public/common/process_type.h" |
| 89 #include "content/public/common/result_codes.h" | 89 #include "content/public/common/result_codes.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 fast_shutdown_started_(false), | 274 fast_shutdown_started_(false), |
| 275 deleting_soon_(false), | 275 deleting_soon_(false), |
| 276 pending_views_(0), | 276 pending_views_(0), |
| 277 visible_widgets_(0), | 277 visible_widgets_(0), |
| 278 backgrounded_(true), | 278 backgrounded_(true), |
| 279 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( | 279 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( |
| 280 FROM_HERE, base::TimeDelta::FromSeconds(5), | 280 FROM_HERE, base::TimeDelta::FromSeconds(5), |
| 281 this, &RenderProcessHostImpl::ClearTransportDIBCache)), | 281 this, &RenderProcessHostImpl::ClearTransportDIBCache)), |
| 282 accessibility_enabled_(false), | 282 accessibility_enabled_(false), |
| 283 is_initialized_(false), | 283 is_initialized_(false), |
| 284 id_(ChildProcessInfo::GenerateChildProcessUniqueId()), | 284 id_(ChildProcessHost::GenerateChildProcessUniqueId()), |
| 285 browser_context_(browser_context), | 285 browser_context_(browser_context), |
| 286 sudden_termination_allowed_(true), | 286 sudden_termination_allowed_(true), |
| 287 ignore_input_events_(false) { | 287 ignore_input_events_(false) { |
| 288 widget_helper_ = new RenderWidgetHelper(); | 288 widget_helper_ = new RenderWidgetHelper(); |
| 289 | 289 |
| 290 ChildProcessSecurityPolicy::GetInstance()->Add(GetID()); | 290 ChildProcessSecurityPolicy::GetInstance()->Add(GetID()); |
| 291 | 291 |
| 292 // Grant most file permissions to this renderer. | 292 // Grant most file permissions to this renderer. |
| 293 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and | 293 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and |
| 294 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API | 294 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 #endif | 378 #endif |
| 379 | 379 |
| 380 // Find the renderer before creating the channel so if this fails early we | 380 // Find the renderer before creating the channel so if this fails early we |
| 381 // return without creating the channel. | 381 // return without creating the channel. |
| 382 FilePath renderer_path = ChildProcessHost::GetChildPath(flags); | 382 FilePath renderer_path = ChildProcessHost::GetChildPath(flags); |
| 383 if (renderer_path.empty()) | 383 if (renderer_path.empty()) |
| 384 return false; | 384 return false; |
| 385 | 385 |
| 386 // Setup the IPC channel. | 386 // Setup the IPC channel. |
| 387 const std::string channel_id = | 387 const std::string channel_id = |
| 388 ChildProcessInfo::GenerateRandomChannelID(this); | 388 ChildProcessHost::GenerateRandomChannelID(this); |
| 389 channel_.reset(new IPC::ChannelProxy( | 389 channel_.reset(new IPC::ChannelProxy( |
| 390 channel_id, IPC::Channel::MODE_SERVER, this, | 390 channel_id, IPC::Channel::MODE_SERVER, this, |
| 391 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 391 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
| 392 | 392 |
| 393 // Call the embedder first so that their IPC filters have priority. | 393 // Call the embedder first so that their IPC filters have priority. |
| 394 content::GetContentClient()->browser()->RenderProcessHostCreated( | 394 content::GetContentClient()->browser()->RenderProcessHostCreated( |
| 395 this); | 395 this); |
| 396 | 396 |
| 397 CreateMessageFilters(); | 397 CreateMessageFilters(); |
| 398 | 398 |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1314 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
| 1315 // Only honor the request if appropriate persmissions are granted. | 1315 // Only honor the request if appropriate persmissions are granted. |
| 1316 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1316 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
| 1317 content::GetContentClient()->browser()->OpenItem(path); | 1317 content::GetContentClient()->browser()->OpenItem(path); |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1320 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
| 1321 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1321 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
| 1322 MHTMLGenerated(job_id, data_size); | 1322 MHTMLGenerated(job_id, data_size); |
| 1323 } | 1323 } |
| OLD | NEW |