| 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 "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" |
| 69 #include "chrome/browser/spellcheck_host.h" | 70 #include "chrome/browser/spellcheck_host.h" |
| 70 #include "chrome/browser/metrics/user_metrics.h" | 71 #include "chrome/browser/metrics/user_metrics.h" |
| 71 #include "chrome/browser/visitedlink/visitedlink_master.h" | 72 #include "chrome/browser/visitedlink/visitedlink_master.h" |
| 72 #include "chrome/browser/worker_host/worker_message_filter.h" | 73 #include "chrome/browser/worker_host/worker_message_filter.h" |
| 73 #include "chrome/common/chrome_paths.h" | 74 #include "chrome/common/chrome_paths.h" |
| 74 #include "chrome/common/chrome_switches.h" | 75 #include "chrome/common/chrome_switches.h" |
| 75 #include "chrome/common/child_process_info.h" | 76 #include "chrome/common/child_process_info.h" |
| 76 #include "chrome/common/extensions/extension.h" | 77 #include "chrome/common/extensions/extension.h" |
| 77 #include "chrome/common/extensions/extension_icon_set.h" | 78 #include "chrome/common/extensions/extension_icon_set.h" |
| 78 #include "chrome/common/gpu_messages.h" | 79 #include "chrome/common/gpu_messages.h" |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 } | 783 } |
| 783 | 784 |
| 784 void BrowserRenderProcessHost::InitExtensions() { | 785 void BrowserRenderProcessHost::InitExtensions() { |
| 785 // TODO(aa): Should only bother sending these function names if this is an | 786 // TODO(aa): Should only bother sending these function names if this is an |
| 786 // extension process. | 787 // extension process. |
| 787 std::vector<std::string> function_names; | 788 std::vector<std::string> function_names; |
| 788 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); | 789 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); |
| 789 Send(new ViewMsg_Extension_SetFunctionNames(function_names)); | 790 Send(new ViewMsg_Extension_SetFunctionNames(function_names)); |
| 790 } | 791 } |
| 791 | 792 |
| 793 void BrowserRenderProcessHost::InitSpeechInput() { |
| 794 Send(new ViewMsg_SpeechInput_SetFeatureEnabled( |
| 795 speech_input::SpeechInputManager::IsFeatureEnabled())); |
| 796 } |
| 797 |
| 792 void BrowserRenderProcessHost::SendUserScriptsUpdate( | 798 void BrowserRenderProcessHost::SendUserScriptsUpdate( |
| 793 base::SharedMemory *shared_memory) { | 799 base::SharedMemory *shared_memory) { |
| 794 // Process is being started asynchronously. We'll end up calling | 800 // Process is being started asynchronously. We'll end up calling |
| 795 // InitUserScripts when it's created which will call this again. | 801 // InitUserScripts when it's created which will call this again. |
| 796 if (child_process_.get() && child_process_->IsStarting()) | 802 if (child_process_.get() && child_process_->IsStarting()) |
| 797 return; | 803 return; |
| 798 | 804 |
| 799 base::SharedMemoryHandle handle_for_process; | 805 base::SharedMemoryHandle handle_for_process; |
| 800 if (!shared_memory->ShareToProcess(GetHandle(), &handle_for_process)) { | 806 if (!shared_memory->ShareToProcess(GetHandle(), &handle_for_process)) { |
| 801 // This can legitimately fail if the renderer asserts at startup. | 807 // This can legitimately fail if the renderer asserts at startup. |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 // 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 |
| 1151 // 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 |
| 1152 // not load at all. (see http://crbug.com/21884). | 1158 // not load at all. (see http://crbug.com/21884). |
| 1153 // 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, |
| 1154 // we could potentially call SetBackgrounded() properly at this point. But | 1160 // we could potentially call SetBackgrounded() properly at this point. But |
| 1155 // 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. |
| 1156 // 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. |
| 1157 | 1163 |
| 1158 Send(new ViewMsg_SetIsIncognitoProcess(profile()->IsOffTheRecord())); | 1164 Send(new ViewMsg_SetIsIncognitoProcess(profile()->IsOffTheRecord())); |
| 1159 | 1165 |
| 1166 InitSpeechInput(); |
| 1160 InitVisitedLinks(); | 1167 InitVisitedLinks(); |
| 1161 InitUserScripts(); | 1168 InitUserScripts(); |
| 1162 InitExtensions(); | 1169 InitExtensions(); |
| 1163 SendExtensionInfo(); | 1170 SendExtensionInfo(); |
| 1164 | 1171 |
| 1165 // We don't want to initialize the spellchecker unless SpellCheckHost has been | 1172 // We don't want to initialize the spellchecker unless SpellCheckHost has been |
| 1166 // created. In InitSpellChecker(), we know if GetSpellCheckHost() is NULL | 1173 // created. In InitSpellChecker(), we know if GetSpellCheckHost() is NULL |
| 1167 // then the spellchecker has been turned off, but here, we don't know if | 1174 // then the spellchecker has been turned off, but here, we don't know if |
| 1168 // it's been turned off or just not loaded yet. | 1175 // it's been turned off or just not loaded yet. |
| 1169 if (profile()->GetSpellCheckHost()) | 1176 if (profile()->GetSpellCheckHost()) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 IPC::PlatformFileForTransit file; | 1288 IPC::PlatformFileForTransit file; |
| 1282 #if defined(OS_POSIX) | 1289 #if defined(OS_POSIX) |
| 1283 file = base::FileDescriptor(model_file, false); | 1290 file = base::FileDescriptor(model_file, false); |
| 1284 #elif defined(OS_WIN) | 1291 #elif defined(OS_WIN) |
| 1285 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, | 1292 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, |
| 1286 false, DUPLICATE_SAME_ACCESS); | 1293 false, DUPLICATE_SAME_ACCESS); |
| 1287 #endif | 1294 #endif |
| 1288 Send(new ViewMsg_SetPhishingModel(file)); | 1295 Send(new ViewMsg_SetPhishingModel(file)); |
| 1289 } | 1296 } |
| 1290 } | 1297 } |
| OLD | NEW |