| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "chrome/browser/renderer_host/render_view_host.h" | 59 #include "chrome/browser/renderer_host/render_view_host.h" |
| 60 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 60 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 61 #include "chrome/browser/renderer_host/render_widget_helper.h" | 61 #include "chrome/browser/renderer_host/render_widget_helper.h" |
| 62 #include "chrome/browser/renderer_host/render_widget_host.h" | 62 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 63 #include "chrome/browser/renderer_host/resource_message_filter.h" | 63 #include "chrome/browser/renderer_host/resource_message_filter.h" |
| 64 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h" | 64 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h" |
| 65 #include "chrome/browser/renderer_host/web_cache_manager.h" | 65 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| 66 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 66 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 67 #include "chrome/browser/search_engines/search_provider_install_state_message_fi
lter.h" | 67 #include "chrome/browser/search_engines/search_provider_install_state_message_fi
lter.h" |
| 68 #include "chrome/browser/speech/speech_input_dispatcher_host.h" | 68 #include "chrome/browser/speech/speech_input_dispatcher_host.h" |
| 69 #include "chrome/browser/speech/speech_input_manager.h" | |
| 70 #include "chrome/browser/spellcheck_host.h" | 69 #include "chrome/browser/spellcheck_host.h" |
| 71 #include "chrome/browser/metrics/user_metrics.h" | 70 #include "chrome/browser/metrics/user_metrics.h" |
| 72 #include "chrome/browser/visitedlink/visitedlink_master.h" | 71 #include "chrome/browser/visitedlink/visitedlink_master.h" |
| 73 #include "chrome/browser/worker_host/worker_message_filter.h" | 72 #include "chrome/browser/worker_host/worker_message_filter.h" |
| 74 #include "chrome/common/chrome_paths.h" | 73 #include "chrome/common/chrome_paths.h" |
| 75 #include "chrome/common/chrome_switches.h" | 74 #include "chrome/common/chrome_switches.h" |
| 76 #include "chrome/common/child_process_info.h" | 75 #include "chrome/common/child_process_info.h" |
| 77 #include "chrome/common/extensions/extension.h" | 76 #include "chrome/common/extensions/extension.h" |
| 78 #include "chrome/common/extensions/extension_icon_set.h" | 77 #include "chrome/common/extensions/extension_icon_set.h" |
| 79 #include "chrome/common/gpu_messages.h" | 78 #include "chrome/common/gpu_messages.h" |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 } | 782 } |
| 784 | 783 |
| 785 void BrowserRenderProcessHost::InitExtensions() { | 784 void BrowserRenderProcessHost::InitExtensions() { |
| 786 // TODO(aa): Should only bother sending these function names if this is an | 785 // TODO(aa): Should only bother sending these function names if this is an |
| 787 // extension process. | 786 // extension process. |
| 788 std::vector<std::string> function_names; | 787 std::vector<std::string> function_names; |
| 789 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); | 788 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); |
| 790 Send(new ViewMsg_Extension_SetFunctionNames(function_names)); | 789 Send(new ViewMsg_Extension_SetFunctionNames(function_names)); |
| 791 } | 790 } |
| 792 | 791 |
| 793 void BrowserRenderProcessHost::InitSpeechInput() { | |
| 794 Send(new ViewMsg_SpeechInput_SetFeatureEnabled( | |
| 795 speech_input::SpeechInputManager::IsFeatureEnabled())); | |
| 796 } | |
| 797 | |
| 798 void BrowserRenderProcessHost::SendUserScriptsUpdate( | 792 void BrowserRenderProcessHost::SendUserScriptsUpdate( |
| 799 base::SharedMemory *shared_memory) { | 793 base::SharedMemory *shared_memory) { |
| 800 // Process is being started asynchronously. We'll end up calling | 794 // Process is being started asynchronously. We'll end up calling |
| 801 // InitUserScripts when it's created which will call this again. | 795 // InitUserScripts when it's created which will call this again. |
| 802 if (child_process_.get() && child_process_->IsStarting()) | 796 if (child_process_.get() && child_process_->IsStarting()) |
| 803 return; | 797 return; |
| 804 | 798 |
| 805 base::SharedMemoryHandle handle_for_process; | 799 base::SharedMemoryHandle handle_for_process; |
| 806 if (!shared_memory->ShareToProcess(GetHandle(), &handle_for_process)) { | 800 if (!shared_memory->ShareToProcess(GetHandle(), &handle_for_process)) { |
| 807 // This can legitimately fail if the renderer asserts at startup. | 801 // This can legitimately fail if the renderer asserts at startup. |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 // we really don't know how it will be used. If it is backgrounded, and not | 1156 // we really don't know how it will be used. If it is backgrounded, and not |
| 1163 // yet processed, a stray hung-cpu process (not chrome) can cause pages to | 1157 // yet processed, a stray hung-cpu process (not chrome) can cause pages to |
| 1164 // not load at all. (see http://crbug.com/21884). | 1158 // not load at all. (see http://crbug.com/21884). |
| 1165 // If we could perfectly track when a process is created as visible or not, | 1159 // If we could perfectly track when a process is created as visible or not, |
| 1166 // we could potentially call SetBackgrounded() properly at this point. But | 1160 // we could potentially call SetBackgrounded() properly at this point. But |
| 1167 // there are many cases, and no effective way to automate those cases. | 1161 // there are many cases, and no effective way to automate those cases. |
| 1168 // I'm choosing correctness over the feature of de-prioritizing this work. | 1162 // I'm choosing correctness over the feature of de-prioritizing this work. |
| 1169 | 1163 |
| 1170 Send(new ViewMsg_SetIsIncognitoProcess(profile()->IsOffTheRecord())); | 1164 Send(new ViewMsg_SetIsIncognitoProcess(profile()->IsOffTheRecord())); |
| 1171 | 1165 |
| 1172 InitSpeechInput(); | |
| 1173 InitVisitedLinks(); | 1166 InitVisitedLinks(); |
| 1174 InitUserScripts(); | 1167 InitUserScripts(); |
| 1175 InitExtensions(); | 1168 InitExtensions(); |
| 1176 SendExtensionInfo(); | 1169 SendExtensionInfo(); |
| 1177 | 1170 |
| 1178 // We don't want to initialize the spellchecker unless SpellCheckHost has been | 1171 // We don't want to initialize the spellchecker unless SpellCheckHost has been |
| 1179 // created. In InitSpellChecker(), we know if GetSpellCheckHost() is NULL | 1172 // created. In InitSpellChecker(), we know if GetSpellCheckHost() is NULL |
| 1180 // then the spellchecker has been turned off, but here, we don't know if | 1173 // then the spellchecker has been turned off, but here, we don't know if |
| 1181 // it's been turned off or just not loaded yet. | 1174 // it's been turned off or just not loaded yet. |
| 1182 if (profile()->GetSpellCheckHost()) | 1175 if (profile()->GetSpellCheckHost()) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 IPC::PlatformFileForTransit file; | 1287 IPC::PlatformFileForTransit file; |
| 1295 #if defined(OS_POSIX) | 1288 #if defined(OS_POSIX) |
| 1296 file = base::FileDescriptor(model_file, false); | 1289 file = base::FileDescriptor(model_file, false); |
| 1297 #elif defined(OS_WIN) | 1290 #elif defined(OS_WIN) |
| 1298 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, | 1291 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, |
| 1299 false, DUPLICATE_SAME_ACCESS); | 1292 false, DUPLICATE_SAME_ACCESS); |
| 1300 #endif | 1293 #endif |
| 1301 Send(new ViewMsg_SetPhishingModel(file)); | 1294 Send(new ViewMsg_SetPhishingModel(file)); |
| 1302 } | 1295 } |
| 1303 } | 1296 } |
| OLD | NEW |