| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 338 |
| 339 resource_message_filter->Init(pid()); | 339 resource_message_filter->Init(pid()); |
| 340 WebCacheManager::GetInstance()->Add(pid()); | 340 WebCacheManager::GetInstance()->Add(pid()); |
| 341 RendererSecurityPolicy::GetInstance()->Add(pid()); | 341 RendererSecurityPolicy::GetInstance()->Add(pid()); |
| 342 | 342 |
| 343 // Now that the process is created, set it's backgrounding accordingly. | 343 // Now that the process is created, set it's backgrounding accordingly. |
| 344 SetBackgrounded(backgrounded_); | 344 SetBackgrounded(backgrounded_); |
| 345 | 345 |
| 346 InitVisitedLinks(); | 346 InitVisitedLinks(); |
| 347 InitUserScripts(); | 347 InitUserScripts(); |
| 348 InitExtensions(); |
| 348 | 349 |
| 349 if (max_page_id_ != -1) | 350 if (max_page_id_ != -1) |
| 350 channel_->Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); | 351 channel_->Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); |
| 351 | 352 |
| 352 return true; | 353 return true; |
| 353 } | 354 } |
| 354 | 355 |
| 355 int BrowserRenderProcessHost::GetNextRoutingID() { | 356 int BrowserRenderProcessHost::GetNextRoutingID() { |
| 356 return widget_helper_->GetNextRoutingID(); | 357 return widget_helper_->GetNextRoutingID(); |
| 357 } | 358 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 441 |
| 441 if (!user_script_master->ScriptsReady()) { | 442 if (!user_script_master->ScriptsReady()) { |
| 442 // No scripts ready. :( | 443 // No scripts ready. :( |
| 443 return; | 444 return; |
| 444 } | 445 } |
| 445 | 446 |
| 446 // Update the renderer process with the current scripts. | 447 // Update the renderer process with the current scripts. |
| 447 SendUserScriptsUpdate(user_script_master->GetSharedMemory()); | 448 SendUserScriptsUpdate(user_script_master->GetSharedMemory()); |
| 448 } | 449 } |
| 449 | 450 |
| 451 void BrowserRenderProcessHost::InitExtensions() { |
| 452 // TODO(aa): Should only bother sending these function names if this is an |
| 453 // extension process. |
| 454 std::vector<std::string> function_names; |
| 455 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); |
| 456 Send(new ViewMsg_Extension_SetFunctionNames(function_names)); |
| 457 } |
| 458 |
| 450 void BrowserRenderProcessHost::SendUserScriptsUpdate( | 459 void BrowserRenderProcessHost::SendUserScriptsUpdate( |
| 451 base::SharedMemory *shared_memory) { | 460 base::SharedMemory *shared_memory) { |
| 452 base::SharedMemoryHandle handle_for_process; | 461 base::SharedMemoryHandle handle_for_process; |
| 453 bool r = shared_memory->ShareToProcess(GetRendererProcessHandle(), | 462 bool r = shared_memory->ShareToProcess(GetRendererProcessHandle(), |
| 454 &handle_for_process); | 463 &handle_for_process); |
| 455 DCHECK(r); | 464 DCHECK(r); |
| 456 if (base::SharedMemory::IsHandleValid(handle_for_process)) { | 465 if (base::SharedMemory::IsHandleValid(handle_for_process)) { |
| 457 channel_->Send(new ViewMsg_UserScripts_NewScripts(handle_for_process)); | 466 channel_->Send(new ViewMsg_UserScripts_NewScripts(handle_for_process)); |
| 458 } | 467 } |
| 459 } | 468 } |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 SendUserScriptsUpdate(shared_memory); | 779 SendUserScriptsUpdate(shared_memory); |
| 771 } | 780 } |
| 772 break; | 781 break; |
| 773 } | 782 } |
| 774 default: { | 783 default: { |
| 775 NOTREACHED(); | 784 NOTREACHED(); |
| 776 break; | 785 break; |
| 777 } | 786 } |
| 778 } | 787 } |
| 779 } | 788 } |
| OLD | NEW |