| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 10 #include <algorithm> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/stl_util-inl.h" | 22 #include "base/stl_util-inl.h" |
| 23 #include "base/string_util.h" | 23 #include "base/string_util.h" |
| 24 #include "base/thread.h" | 24 #include "base/thread.h" |
| 25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
| 26 #include "chrome/browser/child_process_host.h" | 26 #include "chrome/browser/child_process_host.h" |
| 27 #include "chrome/browser/child_process_security_policy.h" | 27 #include "chrome/browser/child_process_security_policy.h" |
| 28 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 28 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 29 #include "chrome/browser/extensions/extension_message_service.h" | 29 #include "chrome/browser/extensions/extension_message_service.h" |
| 30 #include "chrome/browser/extensions/extensions_service.h" | 30 #include "chrome/browser/extensions/extensions_service.h" |
| 31 #include "chrome/browser/extensions/user_script_master.h" | 31 #include "chrome/browser/extensions/user_script_master.h" |
| 32 #include "chrome/browser/gpu_process_host.h" |
| 32 #include "chrome/browser/history/history.h" | 33 #include "chrome/browser/history/history.h" |
| 33 #include "chrome/browser/io_thread.h" | 34 #include "chrome/browser/io_thread.h" |
| 34 #include "chrome/browser/net/url_request_context_getter.h" | 35 #include "chrome/browser/net/url_request_context_getter.h" |
| 35 #include "chrome/browser/plugin_service.h" | 36 #include "chrome/browser/plugin_service.h" |
| 36 #include "chrome/browser/profile.h" | 37 #include "chrome/browser/profile.h" |
| 37 #include "chrome/browser/renderer_host/audio_renderer_host.h" | 38 #include "chrome/browser/renderer_host/audio_renderer_host.h" |
| 38 #include "chrome/browser/renderer_host/render_view_host.h" | 39 #include "chrome/browser/renderer_host/render_view_host.h" |
| 39 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 40 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 40 #include "chrome/browser/renderer_host/render_widget_helper.h" | 41 #include "chrome/browser/renderer_host/render_widget_helper.h" |
| 41 #include "chrome/browser/renderer_host/render_widget_host.h" | 42 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 42 #include "chrome/browser/renderer_host/resource_message_filter.h" | 43 #include "chrome/browser/renderer_host/resource_message_filter.h" |
| 43 #include "chrome/browser/renderer_host/web_cache_manager.h" | 44 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| 44 #include "chrome/browser/spellcheck_host.h" | 45 #include "chrome/browser/spellcheck_host.h" |
| 45 #include "chrome/browser/visitedlink_master.h" | 46 #include "chrome/browser/visitedlink_master.h" |
| 46 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
| 47 #include "chrome/common/child_process_info.h" | 48 #include "chrome/common/child_process_info.h" |
| 49 #include "chrome/common/gpu_messages.h" |
| 48 #include "chrome/common/logging_chrome.h" | 50 #include "chrome/common/logging_chrome.h" |
| 49 #include "chrome/common/notification_service.h" | 51 #include "chrome/common/notification_service.h" |
| 50 #include "chrome/common/pref_names.h" | 52 #include "chrome/common/pref_names.h" |
| 51 #include "chrome/common/process_watcher.h" | 53 #include "chrome/common/process_watcher.h" |
| 52 #include "chrome/common/render_messages.h" | 54 #include "chrome/common/render_messages.h" |
| 53 #include "chrome/common/result_codes.h" | 55 #include "chrome/common/result_codes.h" |
| 54 #include "chrome/renderer/render_process_impl.h" | 56 #include "chrome/renderer/render_process_impl.h" |
| 55 #include "chrome/renderer/render_thread.h" | 57 #include "chrome/renderer/render_thread.h" |
| 56 #include "grit/generated_resources.h" | 58 #include "grit/generated_resources.h" |
| 57 #include "ipc/ipc_logging.h" | 59 #include "ipc/ipc_logging.h" |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdatedCacheStats, | 765 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdatedCacheStats, |
| 764 OnUpdatedCacheStats) | 766 OnUpdatedCacheStats) |
| 765 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, | 767 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, |
| 766 SuddenTerminationChanged); | 768 SuddenTerminationChanged); |
| 767 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionAddListener, | 769 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionAddListener, |
| 768 OnExtensionAddListener) | 770 OnExtensionAddListener) |
| 769 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRemoveListener, | 771 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRemoveListener, |
| 770 OnExtensionRemoveListener) | 772 OnExtensionRemoveListener) |
| 771 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionCloseChannel, | 773 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionCloseChannel, |
| 772 OnExtensionCloseChannel) | 774 OnExtensionCloseChannel) |
| 775 IPC_MESSAGE_HANDLER(ViewHostMsg_EstablishGpuChannel, |
| 776 OnMsgEstablishGpuChannel) |
| 773 IPC_MESSAGE_HANDLER(ViewHostMsg_SpellChecker_RequestDictionary, | 777 IPC_MESSAGE_HANDLER(ViewHostMsg_SpellChecker_RequestDictionary, |
| 774 OnSpellCheckerRequestDictionary) | 778 OnSpellCheckerRequestDictionary) |
| 775 IPC_MESSAGE_UNHANDLED_ERROR() | 779 IPC_MESSAGE_UNHANDLED_ERROR() |
| 776 IPC_END_MESSAGE_MAP_EX() | 780 IPC_END_MESSAGE_MAP_EX() |
| 777 | 781 |
| 778 if (!msg_is_ok) { | 782 if (!msg_is_ok) { |
| 779 // The message had a handler, but its de-serialization failed. | 783 // The message had a handler, but its de-serialization failed. |
| 780 // We consider this a capital crime. Kill the renderer if we have one. | 784 // We consider this a capital crime. Kill the renderer if we have one. |
| 781 ReceivedBadMessage(msg.type()); | 785 ReceivedBadMessage(msg.type()); |
| 782 } | 786 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 event_name, id()); | 971 event_name, id()); |
| 968 } | 972 } |
| 969 } | 973 } |
| 970 | 974 |
| 971 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { | 975 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { |
| 972 if (profile()->GetExtensionMessageService()) { | 976 if (profile()->GetExtensionMessageService()) { |
| 973 profile()->GetExtensionMessageService()->CloseChannel(port_id); | 977 profile()->GetExtensionMessageService()->CloseChannel(port_id); |
| 974 } | 978 } |
| 975 } | 979 } |
| 976 | 980 |
| 981 void BrowserRenderProcessHost::OnMsgEstablishGpuChannel() { |
| 982 GpuProcessHost::Get()->EstablishGpuChannel(id()); |
| 983 } |
| 984 |
| 977 void BrowserRenderProcessHost::OnSpellCheckerRequestDictionary() { | 985 void BrowserRenderProcessHost::OnSpellCheckerRequestDictionary() { |
| 978 if (profile()->GetSpellCheckHost()) { | 986 if (profile()->GetSpellCheckHost()) { |
| 979 // The spellchecker initialization already started and finished; just send | 987 // The spellchecker initialization already started and finished; just send |
| 980 // it to the renderer. | 988 // it to the renderer. |
| 981 InitSpellChecker(); | 989 InitSpellChecker(); |
| 982 } else { | 990 } else { |
| 983 // We may have gotten multiple requests from different renderers. We don't | 991 // We may have gotten multiple requests from different renderers. We don't |
| 984 // want to initialize multiple times in this case, so we set |force| to | 992 // want to initialize multiple times in this case, so we set |force| to |
| 985 // false. | 993 // false. |
| 986 profile()->ReinitializeSpellCheckHost(false); | 994 profile()->ReinitializeSpellCheckHost(false); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1016 IPC::InvalidPlatformFileForTransit(), | 1024 IPC::InvalidPlatformFileForTransit(), |
| 1017 std::vector<std::string>(), | 1025 std::vector<std::string>(), |
| 1018 std::string(), | 1026 std::string(), |
| 1019 false)); | 1027 false)); |
| 1020 } | 1028 } |
| 1021 } | 1029 } |
| 1022 | 1030 |
| 1023 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { | 1031 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { |
| 1024 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); | 1032 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); |
| 1025 } | 1033 } |
| OLD | NEW |