| 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/browser_render_process_host.h" | 8 #include "content/browser/renderer_host/browser_render_process_host.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <limits> | 11 #include <limits> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #if defined(OS_POSIX) | 14 #if defined(OS_POSIX) |
| 15 #include <utility> // for pair<> | 15 #include <utility> // for pair<> |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 #include "base/callback.h" | 18 #include "base/callback.h" |
| 19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 20 #include "base/logging.h" | 20 #include "base/logging.h" |
| 21 #include "base/metrics/field_trial.h" | 21 #include "base/metrics/field_trial.h" |
| 22 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
| 23 #include "base/path_service.h" | 23 #include "base/path_service.h" |
| 24 #include "base/platform_file.h" | 24 #include "base/platform_file.h" |
| 25 #include "base/stl_util.h" | 25 #include "base/stl_util.h" |
| 26 #include "base/string_util.h" | 26 #include "base/string_util.h" |
| 27 #include "base/threading/thread.h" | 27 #include "base/threading/thread.h" |
| 28 #include "base/threading/thread_restrictions.h" | 28 #include "base/threading/thread_restrictions.h" |
| 29 #include "chrome/browser/profiles/profile.h" | |
| 30 #include "content/browser/appcache/appcache_dispatcher_host.h" | 29 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 31 #include "content/browser/browser_child_process_host.h" | 30 #include "content/browser/browser_child_process_host.h" |
| 31 #include "content/browser/browser_context.h" |
| 32 #include "content/browser/child_process_security_policy.h" | 32 #include "content/browser/child_process_security_policy.h" |
| 33 #include "content/browser/content_browser_client.h" | 33 #include "content/browser/content_browser_client.h" |
| 34 #include "content/browser/device_orientation/message_filter.h" | 34 #include "content/browser/device_orientation/message_filter.h" |
| 35 #include "content/browser/download/mhtml_generation_manager.h" | 35 #include "content/browser/download/mhtml_generation_manager.h" |
| 36 #include "content/browser/file_system/file_system_dispatcher_host.h" | 36 #include "content/browser/file_system/file_system_dispatcher_host.h" |
| 37 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | 37 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
| 38 #include "content/browser/gpu/gpu_data_manager.h" | 38 #include "content/browser/gpu/gpu_data_manager.h" |
| 39 #include "content/browser/gpu/gpu_process_host.h" | 39 #include "content/browser/gpu/gpu_process_host.h" |
| 40 #include "content/browser/in_process_webkit/dom_storage_message_filter.h" | 40 #include "content/browser/in_process_webkit/dom_storage_message_filter.h" |
| 41 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 41 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 RenderProcess* render_process_; | 144 RenderProcess* render_process_; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 namespace { | 147 namespace { |
| 148 | 148 |
| 149 // Helper class that we pass to ResourceMessageFilter so that it can find the | 149 // Helper class that we pass to ResourceMessageFilter so that it can find the |
| 150 // right net::URLRequestContext for a request. | 150 // right net::URLRequestContext for a request. |
| 151 class RendererURLRequestContextSelector | 151 class RendererURLRequestContextSelector |
| 152 : public ResourceMessageFilter::URLRequestContextSelector { | 152 : public ResourceMessageFilter::URLRequestContextSelector { |
| 153 public: | 153 public: |
| 154 RendererURLRequestContextSelector(Profile* profile, | 154 RendererURLRequestContextSelector(content::BrowserContext* browser_context, |
| 155 int render_child_id) | 155 int render_child_id) |
| 156 : request_context_(profile->GetRequestContextForRenderProcess( | 156 : request_context_(browser_context->GetRequestContextForRenderProcess( |
| 157 render_child_id)), | 157 render_child_id)), |
| 158 media_request_context_(profile->GetRequestContextForMedia()) { | 158 media_request_context_(browser_context->GetRequestContextForMedia()) { |
| 159 } | 159 } |
| 160 | 160 |
| 161 virtual net::URLRequestContext* GetRequestContext( | 161 virtual net::URLRequestContext* GetRequestContext( |
| 162 ResourceType::Type resource_type) { | 162 ResourceType::Type resource_type) { |
| 163 net::URLRequestContextGetter* request_context = request_context_; | 163 net::URLRequestContextGetter* request_context = request_context_; |
| 164 // If the request has resource type of ResourceType::MEDIA, we use a request | 164 // If the request has resource type of ResourceType::MEDIA, we use a request |
| 165 // context specific to media for handling it because these resources have | 165 // context specific to media for handling it because these resources have |
| 166 // specific needs for caching. | 166 // specific needs for caching. |
| 167 if (resource_type == ResourceType::MEDIA) | 167 if (resource_type == ResourceType::MEDIA) |
| 168 request_context = media_request_context_; | 168 request_context = media_request_context_; |
| 169 return request_context->GetURLRequestContext(); | 169 return request_context->GetURLRequestContext(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 private: | 172 private: |
| 173 virtual ~RendererURLRequestContextSelector() {} | 173 virtual ~RendererURLRequestContextSelector() {} |
| 174 | 174 |
| 175 scoped_refptr<net::URLRequestContextGetter> request_context_; | 175 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 176 scoped_refptr<net::URLRequestContextGetter> media_request_context_; | 176 scoped_refptr<net::URLRequestContextGetter> media_request_context_; |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 } // namespace | 179 } // namespace |
| 180 | 180 |
| 181 BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile) | 181 BrowserRenderProcessHost::BrowserRenderProcessHost( |
| 182 : RenderProcessHost(profile), | 182 content::BrowserContext* browser_context) |
| 183 visible_widgets_(0), | 183 : RenderProcessHost(browser_context), |
| 184 backgrounded_(true), | 184 visible_widgets_(0), |
| 185 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( | 185 backgrounded_(true), |
| 186 base::TimeDelta::FromSeconds(5), | 186 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( |
| 187 this, &BrowserRenderProcessHost::ClearTransportDIBCache)), | 187 base::TimeDelta::FromSeconds(5), |
| 188 accessibility_enabled_(false), | 188 this, &BrowserRenderProcessHost::ClearTransportDIBCache)), |
| 189 is_initialized_(false) { | 189 accessibility_enabled_(false), |
| 190 is_initialized_(false) { |
| 190 widget_helper_ = new RenderWidgetHelper(); | 191 widget_helper_ = new RenderWidgetHelper(); |
| 191 | 192 |
| 192 ChildProcessSecurityPolicy::GetInstance()->Add(id()); | 193 ChildProcessSecurityPolicy::GetInstance()->Add(id()); |
| 193 | 194 |
| 194 // Grant most file permissions to this renderer. | 195 // Grant most file permissions to this renderer. |
| 195 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and | 196 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and |
| 196 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API | 197 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API |
| 197 // requests them. | 198 // requests them. |
| 198 // This is for the filesystem sandbox. | 199 // This is for the filesystem sandbox. |
| 199 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | 200 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( |
| 200 id(), profile->GetPath().Append( | 201 id(), browser_context->GetPath().Append( |
| 201 fileapi::SandboxMountPointProvider::kNewFileSystemDirectory), | 202 fileapi::SandboxMountPointProvider::kNewFileSystemDirectory), |
| 202 base::PLATFORM_FILE_OPEN | | 203 base::PLATFORM_FILE_OPEN | |
| 203 base::PLATFORM_FILE_CREATE | | 204 base::PLATFORM_FILE_CREATE | |
| 204 base::PLATFORM_FILE_OPEN_ALWAYS | | 205 base::PLATFORM_FILE_OPEN_ALWAYS | |
| 205 base::PLATFORM_FILE_CREATE_ALWAYS | | 206 base::PLATFORM_FILE_CREATE_ALWAYS | |
| 206 base::PLATFORM_FILE_OPEN_TRUNCATED | | 207 base::PLATFORM_FILE_OPEN_TRUNCATED | |
| 207 base::PLATFORM_FILE_READ | | 208 base::PLATFORM_FILE_READ | |
| 208 base::PLATFORM_FILE_WRITE | | 209 base::PLATFORM_FILE_WRITE | |
| 209 base::PLATFORM_FILE_EXCLUSIVE_READ | | 210 base::PLATFORM_FILE_EXCLUSIVE_READ | |
| 210 base::PLATFORM_FILE_EXCLUSIVE_WRITE | | 211 base::PLATFORM_FILE_EXCLUSIVE_WRITE | |
| 211 base::PLATFORM_FILE_ASYNC | | 212 base::PLATFORM_FILE_ASYNC | |
| 212 base::PLATFORM_FILE_WRITE_ATTRIBUTES | | 213 base::PLATFORM_FILE_WRITE_ATTRIBUTES | |
| 213 base::PLATFORM_FILE_ENUMERATE); | 214 base::PLATFORM_FILE_ENUMERATE); |
| 214 // This is so that we can read and move stuff out of the old filesystem | 215 // This is so that we can read and move stuff out of the old filesystem |
| 215 // sandbox. | 216 // sandbox. |
| 216 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | 217 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( |
| 217 id(), profile->GetPath().Append( | 218 id(), browser_context->GetPath().Append( |
| 218 fileapi::SandboxMountPointProvider::kOldFileSystemDirectory), | 219 fileapi::SandboxMountPointProvider::kOldFileSystemDirectory), |
| 219 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | | 220 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | |
| 220 base::PLATFORM_FILE_WRITE_ATTRIBUTES | base::PLATFORM_FILE_ENUMERATE); | 221 base::PLATFORM_FILE_WRITE_ATTRIBUTES | base::PLATFORM_FILE_ENUMERATE); |
| 221 // This is so that we can rename the old sandbox out of the way so that we | 222 // This is so that we can rename the old sandbox out of the way so that we |
| 222 // know we've taken care of it. | 223 // know we've taken care of it. |
| 223 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | 224 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( |
| 224 id(), profile->GetPath().Append( | 225 id(), browser_context->GetPath().Append( |
| 225 fileapi::SandboxMountPointProvider::kRenamedOldFileSystemDirectory), | 226 fileapi::SandboxMountPointProvider::kRenamedOldFileSystemDirectory), |
| 226 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | | 227 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | |
| 227 base::PLATFORM_FILE_WRITE); | 228 base::PLATFORM_FILE_WRITE); |
| 228 | 229 |
| 229 // Note: When we create the BrowserRenderProcessHost, it's technically | 230 // Note: When we create the BrowserRenderProcessHost, it's technically |
| 230 // backgrounded, because it has no visible listeners. But the process | 231 // backgrounded, because it has no visible listeners. But the process |
| 231 // doesn't actually exist yet, so we'll Background it later, after | 232 // doesn't actually exist yet, so we'll Background it later, after |
| 232 // creation. | 233 // creation. |
| 233 } | 234 } |
| 234 | 235 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 337 |
| 337 is_initialized_ = true; | 338 is_initialized_ = true; |
| 338 return true; | 339 return true; |
| 339 } | 340 } |
| 340 | 341 |
| 341 void BrowserRenderProcessHost::CreateMessageFilters() { | 342 void BrowserRenderProcessHost::CreateMessageFilters() { |
| 342 scoped_refptr<RenderMessageFilter> render_message_filter( | 343 scoped_refptr<RenderMessageFilter> render_message_filter( |
| 343 new RenderMessageFilter( | 344 new RenderMessageFilter( |
| 344 id(), | 345 id(), |
| 345 PluginService::GetInstance(), | 346 PluginService::GetInstance(), |
| 346 profile(), | 347 browser_context(), |
| 347 profile()->GetRequestContextForRenderProcess(id()), | 348 browser_context()->GetRequestContextForRenderProcess(id()), |
| 348 widget_helper_)); | 349 widget_helper_)); |
| 349 channel_->AddFilter(render_message_filter); | 350 channel_->AddFilter(render_message_filter); |
| 350 | 351 |
| 351 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 352 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
| 352 id(), ChildProcessInfo::RENDER_PROCESS, | 353 id(), ChildProcessInfo::RENDER_PROCESS, |
| 353 &profile()->GetResourceContext(), | 354 &browser_context()->GetResourceContext(), |
| 354 new RendererURLRequestContextSelector(profile(), id()), | 355 new RendererURLRequestContextSelector(browser_context(), id()), |
| 355 content::GetContentClient()->browser()->GetResourceDispatcherHost()); | 356 content::GetContentClient()->browser()->GetResourceDispatcherHost()); |
| 356 | 357 |
| 357 channel_->AddFilter(resource_message_filter); | 358 channel_->AddFilter(resource_message_filter); |
| 358 channel_->AddFilter(new AudioInputRendererHost()); | 359 channel_->AddFilter(new AudioInputRendererHost()); |
| 359 channel_->AddFilter(new AudioRendererHost(&profile()->GetResourceContext())); | 360 channel_->AddFilter( |
| 361 new AudioRendererHost(&browser_context()->GetResourceContext())); |
| 360 channel_->AddFilter(new VideoCaptureHost()); | 362 channel_->AddFilter(new VideoCaptureHost()); |
| 361 channel_->AddFilter( | 363 channel_->AddFilter( |
| 362 new AppCacheDispatcherHost(&profile()->GetResourceContext(), id())); | 364 new AppCacheDispatcherHost(&browser_context()->GetResourceContext(), |
| 365 id())); |
| 363 channel_->AddFilter(new ClipboardMessageFilter()); | 366 channel_->AddFilter(new ClipboardMessageFilter()); |
| 364 channel_->AddFilter( | 367 channel_->AddFilter( |
| 365 new DOMStorageMessageFilter(id(), profile()->GetWebKitContext())); | 368 new DOMStorageMessageFilter(id(), browser_context()->GetWebKitContext())); |
| 366 channel_->AddFilter( | 369 channel_->AddFilter( |
| 367 new IndexedDBDispatcherHost(id(), profile()->GetWebKitContext())); | 370 new IndexedDBDispatcherHost(id(), browser_context()->GetWebKitContext())); |
| 368 channel_->AddFilter( | 371 channel_->AddFilter( |
| 369 GeolocationDispatcherHost::New( | 372 GeolocationDispatcherHost::New( |
| 370 id(), profile()->GetGeolocationPermissionContext())); | 373 id(), browser_context()->GetGeolocationPermissionContext())); |
| 371 channel_->AddFilter(new GpuMessageFilter(id(), widget_helper_.get())); | 374 channel_->AddFilter(new GpuMessageFilter(id(), widget_helper_.get())); |
| 372 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost(id())); | 375 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost(id())); |
| 373 channel_->AddFilter(new PepperFileMessageFilter(id(), profile())); | 376 channel_->AddFilter(new PepperFileMessageFilter(id(), browser_context())); |
| 374 channel_->AddFilter( | 377 channel_->AddFilter( |
| 375 new PepperMessageFilter(&profile()->GetResourceContext())); | 378 new PepperMessageFilter(&browser_context()->GetResourceContext())); |
| 376 channel_->AddFilter(new speech_input::SpeechInputDispatcherHost(id())); | 379 channel_->AddFilter(new speech_input::SpeechInputDispatcherHost(id())); |
| 377 channel_->AddFilter( | 380 channel_->AddFilter( |
| 378 new FileSystemDispatcherHost(&profile()->GetResourceContext())); | 381 new FileSystemDispatcherHost(&browser_context()->GetResourceContext())); |
| 379 channel_->AddFilter(new device_orientation::MessageFilter()); | 382 channel_->AddFilter(new device_orientation::MessageFilter()); |
| 380 channel_->AddFilter( | 383 channel_->AddFilter( |
| 381 new BlobMessageFilter(id(), profile()->GetBlobStorageContext())); | 384 new BlobMessageFilter(id(), browser_context()->GetBlobStorageContext())); |
| 382 channel_->AddFilter(new FileUtilitiesMessageFilter(id())); | 385 channel_->AddFilter(new FileUtilitiesMessageFilter(id())); |
| 383 channel_->AddFilter(new MimeRegistryMessageFilter()); | 386 channel_->AddFilter(new MimeRegistryMessageFilter()); |
| 384 channel_->AddFilter(new DatabaseMessageFilter( | 387 channel_->AddFilter(new DatabaseMessageFilter( |
| 385 profile()->GetDatabaseTracker())); | 388 browser_context()->GetDatabaseTracker())); |
| 386 | 389 |
| 387 SocketStreamDispatcherHost* socket_stream_dispatcher_host = | 390 SocketStreamDispatcherHost* socket_stream_dispatcher_host = |
| 388 new SocketStreamDispatcherHost( | 391 new SocketStreamDispatcherHost( |
| 389 new RendererURLRequestContextSelector(profile(), id()), | 392 new RendererURLRequestContextSelector(browser_context(), id()), |
| 390 &profile()->GetResourceContext()); | 393 &browser_context()->GetResourceContext()); |
| 391 channel_->AddFilter(socket_stream_dispatcher_host); | 394 channel_->AddFilter(socket_stream_dispatcher_host); |
| 392 | 395 |
| 393 channel_->AddFilter( | 396 channel_->AddFilter( |
| 394 new WorkerMessageFilter( | 397 new WorkerMessageFilter( |
| 395 id(), | 398 id(), |
| 396 &profile()->GetResourceContext(), | 399 &browser_context()->GetResourceContext(), |
| 397 content::GetContentClient()->browser()->GetResourceDispatcherHost(), | 400 content::GetContentClient()->browser()->GetResourceDispatcherHost(), |
| 398 NewCallbackWithReturnValue( | 401 NewCallbackWithReturnValue( |
| 399 widget_helper_.get(), &RenderWidgetHelper::GetNextRoutingID))); | 402 widget_helper_.get(), &RenderWidgetHelper::GetNextRoutingID))); |
| 400 | 403 |
| 401 #if defined(ENABLE_P2P_APIS) | 404 #if defined(ENABLE_P2P_APIS) |
| 402 channel_->AddFilter(new P2PSocketDispatcherHost()); | 405 channel_->AddFilter(new P2PSocketDispatcherHost()); |
| 403 #endif | 406 #endif |
| 404 | 407 |
| 405 channel_->AddFilter(new TraceMessageFilter()); | 408 channel_->AddFilter(new TraceMessageFilter()); |
| 406 channel_->AddFilter(new ResolveProxyMsgHelper(NULL)); | 409 channel_->AddFilter(new ResolveProxyMsgHelper(NULL)); |
| 407 channel_->AddFilter(new QuotaDispatcherHost( | 410 channel_->AddFilter(new QuotaDispatcherHost( |
| 408 id(), profile()->GetQuotaManager(), | 411 id(), browser_context()->GetQuotaManager(), |
| 409 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); | 412 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); |
| 410 } | 413 } |
| 411 | 414 |
| 412 int BrowserRenderProcessHost::GetNextRoutingID() { | 415 int BrowserRenderProcessHost::GetNextRoutingID() { |
| 413 return widget_helper_->GetNextRoutingID(); | 416 return widget_helper_->GetNextRoutingID(); |
| 414 } | 417 } |
| 415 | 418 |
| 416 void BrowserRenderProcessHost::CancelResourceRequests(int render_widget_id) { | 419 void BrowserRenderProcessHost::CancelResourceRequests(int render_widget_id) { |
| 417 widget_helper_->CancelResourceRequests(render_widget_id); | 420 widget_helper_->CancelResourceRequests(render_widget_id); |
| 418 } | 421 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 switches::kUserAgent, | 595 switches::kUserAgent, |
| 593 switches::kV, | 596 switches::kV, |
| 594 switches::kVideoThreads, | 597 switches::kVideoThreads, |
| 595 switches::kVModule, | 598 switches::kVModule, |
| 596 switches::kWebCoreLogChannels, | 599 switches::kWebCoreLogChannels, |
| 597 }; | 600 }; |
| 598 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, | 601 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, |
| 599 arraysize(kSwitchNames)); | 602 arraysize(kSwitchNames)); |
| 600 | 603 |
| 601 // Disable databases in incognito mode. | 604 // Disable databases in incognito mode. |
| 602 if (profile()->IsOffTheRecord() && | 605 if (browser_context()->IsOffTheRecord() && |
| 603 !browser_cmd.HasSwitch(switches::kDisableDatabases)) { | 606 !browser_cmd.HasSwitch(switches::kDisableDatabases)) { |
| 604 renderer_cmd->AppendSwitch(switches::kDisableDatabases); | 607 renderer_cmd->AppendSwitch(switches::kDisableDatabases); |
| 605 } | 608 } |
| 606 } | 609 } |
| 607 | 610 |
| 608 base::ProcessHandle BrowserRenderProcessHost::GetHandle() { | 611 base::ProcessHandle BrowserRenderProcessHost::GetHandle() { |
| 609 // child_process_launcher_ is null either because we're in single process | 612 // child_process_launcher_ is null either because we're in single process |
| 610 // mode, we have done fast termination, or the process has crashed. | 613 // mode, we have done fast termination, or the process has crashed. |
| 611 if (run_renderer_in_process() || !child_process_launcher_.get()) | 614 if (run_renderer_in_process() || !child_process_launcher_.get()) |
| 612 return base::Process::Current().handle(); | 615 return base::Process::Current().handle(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 725 |
| 723 if (child_process_launcher_.get() && child_process_launcher_->IsStarting()) { | 726 if (child_process_launcher_.get() && child_process_launcher_->IsStarting()) { |
| 724 queued_messages_.push(msg); | 727 queued_messages_.push(msg); |
| 725 return true; | 728 return true; |
| 726 } | 729 } |
| 727 | 730 |
| 728 return channel_->Send(msg); | 731 return channel_->Send(msg); |
| 729 } | 732 } |
| 730 | 733 |
| 731 bool BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { | 734 bool BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 732 // If we're about to be deleted, we can no longer trust that our profile is | 735 // If we're about to be deleted, we can no longer trust that our browser |
| 733 // valid, so we ignore incoming messages. | 736 // context is valid, so we ignore incoming messages. |
| 734 if (deleting_soon_) | 737 if (deleting_soon_) |
| 735 return false; | 738 return false; |
| 736 | 739 |
| 737 mark_child_process_activity_time(); | 740 mark_child_process_activity_time(); |
| 738 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 741 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
| 739 // Dispatch control messages. | 742 // Dispatch control messages. |
| 740 bool msg_is_ok = true; | 743 bool msg_is_ok = true; |
| 741 IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok) | 744 IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok) |
| 742 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, | 745 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, |
| 743 OnShutdownRequest) | 746 OnShutdownRequest) |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { | 920 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { |
| 918 // Only honor the request if appropriate persmissions are granted. | 921 // Only honor the request if appropriate persmissions are granted. |
| 919 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) | 922 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) |
| 920 content::GetContentClient()->browser()->RevealFolderInOS(path); | 923 content::GetContentClient()->browser()->RevealFolderInOS(path); |
| 921 } | 924 } |
| 922 | 925 |
| 923 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) { | 926 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) { |
| 924 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 927 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
| 925 MHTMLGenerated(job_id, success); | 928 MHTMLGenerated(job_id, success); |
| 926 } | 929 } |
| OLD | NEW |