Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(862)

Side by Side Diff: chrome/browser/renderer_host/browser_render_process_host.cc

Issue 6128001: If speech input is disabled and we receive IPC calls, terminate the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/speech/speech_input_dispatcher_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "chrome/browser/renderer_host/render_view_host.h" 58 #include "chrome/browser/renderer_host/render_view_host.h"
59 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 59 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
60 #include "chrome/browser/renderer_host/render_widget_helper.h" 60 #include "chrome/browser/renderer_host/render_widget_helper.h"
61 #include "chrome/browser/renderer_host/render_widget_host.h" 61 #include "chrome/browser/renderer_host/render_widget_host.h"
62 #include "chrome/browser/renderer_host/resource_message_filter.h" 62 #include "chrome/browser/renderer_host/resource_message_filter.h"
63 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h" 63 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h"
64 #include "chrome/browser/renderer_host/web_cache_manager.h" 64 #include "chrome/browser/renderer_host/web_cache_manager.h"
65 #include "chrome/browser/safe_browsing/client_side_detection_service.h" 65 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
66 #include "chrome/browser/search_engines/search_provider_install_state_message_fi lter.h" 66 #include "chrome/browser/search_engines/search_provider_install_state_message_fi lter.h"
67 #include "chrome/browser/speech/speech_input_dispatcher_host.h" 67 #include "chrome/browser/speech/speech_input_dispatcher_host.h"
68 #include "chrome/browser/speech/speech_input_manager.h"
68 #include "chrome/browser/spellcheck_host.h" 69 #include "chrome/browser/spellcheck_host.h"
69 #include "chrome/browser/metrics/user_metrics.h" 70 #include "chrome/browser/metrics/user_metrics.h"
70 #include "chrome/browser/visitedlink/visitedlink_master.h" 71 #include "chrome/browser/visitedlink/visitedlink_master.h"
71 #include "chrome/browser/worker_host/worker_message_filter.h" 72 #include "chrome/browser/worker_host/worker_message_filter.h"
72 #include "chrome/common/chrome_paths.h" 73 #include "chrome/common/chrome_paths.h"
73 #include "chrome/common/chrome_switches.h" 74 #include "chrome/common/chrome_switches.h"
74 #include "chrome/common/child_process_info.h" 75 #include "chrome/common/child_process_info.h"
75 #include "chrome/common/extensions/extension.h" 76 #include "chrome/common/extensions/extension.h"
76 #include "chrome/common/extensions/extension_icon_set.h" 77 #include "chrome/common/extensions/extension_icon_set.h"
77 #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
781 782
782 void BrowserRenderProcessHost::InitExtensions() { 783 void BrowserRenderProcessHost::InitExtensions() {
783 // TODO(aa): Should only bother sending these function names if this is an 784 // TODO(aa): Should only bother sending these function names if this is an
784 // extension process. 785 // extension process.
785 std::vector<std::string> function_names; 786 std::vector<std::string> function_names;
786 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); 787 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names);
787 Send(new ViewMsg_Extension_SetFunctionNames(function_names)); 788 Send(new ViewMsg_Extension_SetFunctionNames(function_names));
788 } 789 }
789 790
790 void BrowserRenderProcessHost::InitSpeechInput() { 791 void BrowserRenderProcessHost::InitSpeechInput() {
791 bool enabled = true; 792 Send(new ViewMsg_SpeechInput_SetFeatureEnabled(
792 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 793 speech_input::SpeechInputManager::IsFeatureEnabled()));
793
794 if (command_line.HasSwitch(switches::kDisableSpeechInput)) {
795 enabled = false;
796 #if defined(GOOGLE_CHROME_BUILD)
797 } else if (!command_line.HasSwitch(switches::kEnableSpeechInput)) {
798 // We need to evaluate whether IO is OK here. http://crbug.com/63335.
799 base::ThreadRestrictions::ScopedAllowIO allow_io;
800 // Official Chrome builds have speech input enabled by default only in the
801 // dev channel.
802 std::string channel = platform_util::GetVersionStringModifier();
803 enabled = (channel == "dev");
804 #endif
805 }
806
807 Send(new ViewMsg_SpeechInput_SetFeatureEnabled(enabled));
808 } 794 }
809 795
810 void BrowserRenderProcessHost::SendUserScriptsUpdate( 796 void BrowserRenderProcessHost::SendUserScriptsUpdate(
811 base::SharedMemory *shared_memory) { 797 base::SharedMemory *shared_memory) {
812 // Process is being started asynchronously. We'll end up calling 798 // Process is being started asynchronously. We'll end up calling
813 // InitUserScripts when it's created which will call this again. 799 // InitUserScripts when it's created which will call this again.
814 if (child_process_.get() && child_process_->IsStarting()) 800 if (child_process_.get() && child_process_->IsStarting())
815 return; 801 return;
816 802
817 base::SharedMemoryHandle handle_for_process; 803 base::SharedMemoryHandle handle_for_process;
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 IPC::PlatformFileForTransit file; 1292 IPC::PlatformFileForTransit file;
1307 #if defined(OS_POSIX) 1293 #if defined(OS_POSIX)
1308 file = base::FileDescriptor(model_file, false); 1294 file = base::FileDescriptor(model_file, false);
1309 #elif defined(OS_WIN) 1295 #elif defined(OS_WIN)
1310 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, 1296 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0,
1311 false, DUPLICATE_SAME_ACCESS); 1297 false, DUPLICATE_SAME_ACCESS);
1312 #endif 1298 #endif
1313 Send(new ViewMsg_SetPhishingModel(file)); 1299 Send(new ViewMsg_SetPhishingModel(file));
1314 } 1300 }
1315 } 1301 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/speech/speech_input_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698