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 #include "chrome/renderer/render_thread.h" | 5 #include "chrome/renderer/render_thread.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 if (RenderProcessImpl::InProcessPlugins()) | 258 if (RenderProcessImpl::InProcessPlugins()) |
259 CoInitialize(0); | 259 CoInitialize(0); |
260 #endif | 260 #endif |
261 | 261 |
262 std::string type_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 262 std::string type_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
263 switches::kProcessType); | 263 switches::kProcessType); |
264 // In single process the single process is all there is. | 264 // In single process the single process is all there is. |
265 is_extension_process_ = type_str == switches::kExtensionProcess || | 265 is_extension_process_ = type_str == switches::kExtensionProcess || |
266 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 266 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
267 is_incognito_process_ = false; | 267 is_incognito_process_ = false; |
| 268 is_speech_input_enabled_ = false; |
268 suspend_webkit_shared_timer_ = true; | 269 suspend_webkit_shared_timer_ = true; |
269 notify_webkit_of_modal_loop_ = true; | 270 notify_webkit_of_modal_loop_ = true; |
270 plugin_refresh_allowed_ = true; | 271 plugin_refresh_allowed_ = true; |
271 cache_stats_task_pending_ = false; | 272 cache_stats_task_pending_ = false; |
272 widget_count_ = 0; | 273 widget_count_ = 0; |
273 hidden_widget_count_ = 0; | 274 hidden_widget_count_ = 0; |
274 idle_notification_delay_in_s_ = is_extension_process_ ? | 275 idle_notification_delay_in_s_ = is_extension_process_ ? |
275 kInitialExtensionIdleHandlerDelayS : kInitialIdleHandlerDelayS; | 276 kInitialExtensionIdleHandlerDelayS : kInitialIdleHandlerDelayS; |
276 task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this)); | 277 task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this)); |
277 callback_factory_.reset(new base::ScopedCallbackFactory<RenderThread>(this)); | 278 callback_factory_.reset(new base::ScopedCallbackFactory<RenderThread>(this)); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 OnSetIPCLoggingEnabled) | 632 OnSetIPCLoggingEnabled) |
632 #endif | 633 #endif |
633 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_Init, | 634 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_Init, |
634 OnInitSpellChecker) | 635 OnInitSpellChecker) |
635 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_WordAdded, | 636 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_WordAdded, |
636 OnSpellCheckWordAdded) | 637 OnSpellCheckWordAdded) |
637 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect, | 638 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect, |
638 OnSpellCheckEnableAutoSpellCorrect) | 639 OnSpellCheckEnableAutoSpellCorrect) |
639 IPC_MESSAGE_HANDLER(ViewMsg_GpuChannelEstablished, OnGpuChannelEstablished) | 640 IPC_MESSAGE_HANDLER(ViewMsg_GpuChannelEstablished, OnGpuChannelEstablished) |
640 IPC_MESSAGE_HANDLER(ViewMsg_SetPhishingModel, OnSetPhishingModel) | 641 IPC_MESSAGE_HANDLER(ViewMsg_SetPhishingModel, OnSetPhishingModel) |
| 642 IPC_MESSAGE_HANDLER(ViewMsg_SpeechInput_SetFeatureEnabled, |
| 643 OnSetSpeechInputEnabled) |
641 IPC_MESSAGE_UNHANDLED(handled = false) | 644 IPC_MESSAGE_UNHANDLED(handled = false) |
642 IPC_END_MESSAGE_MAP() | 645 IPC_END_MESSAGE_MAP() |
643 return handled; | 646 return handled; |
644 } | 647 } |
645 | 648 |
| 649 void RenderThread::OnSetSpeechInputEnabled(bool enabled) { |
| 650 DCHECK(!webkit_client_.get()); |
| 651 is_speech_input_enabled_ = enabled; |
| 652 } |
| 653 |
646 void RenderThread::OnSetNextPageID(int32 next_page_id) { | 654 void RenderThread::OnSetNextPageID(int32 next_page_id) { |
647 // This should only be called at process initialization time, so we shouldn't | 655 // This should only be called at process initialization time, so we shouldn't |
648 // have to worry about thread-safety. | 656 // have to worry about thread-safety. |
649 RenderView::SetNextPageID(next_page_id); | 657 RenderView::SetNextPageID(next_page_id); |
650 } | 658 } |
651 | 659 |
652 // Called when to register CSS Color name->system color mappings. | 660 // Called when to register CSS Color name->system color mappings. |
653 // We update the colors one by one and then tell WebKit to refresh all render | 661 // We update the colors one by one and then tell WebKit to refresh all render |
654 // views. | 662 // views. |
655 void RenderThread::OnSetCSSColors( | 663 void RenderThread::OnSetCSSColors( |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 | 945 |
938 WebRuntimeFeatures::enableTouch( | 946 WebRuntimeFeatures::enableTouch( |
939 command_line.HasSwitch(switches::kEnableTouch)); | 947 command_line.HasSwitch(switches::kEnableTouch)); |
940 | 948 |
941 WebRuntimeFeatures::enableDeviceMotion( | 949 WebRuntimeFeatures::enableDeviceMotion( |
942 command_line.HasSwitch(switches::kEnableDeviceMotion)); | 950 command_line.HasSwitch(switches::kEnableDeviceMotion)); |
943 | 951 |
944 WebRuntimeFeatures::enableDeviceOrientation( | 952 WebRuntimeFeatures::enableDeviceOrientation( |
945 !command_line.HasSwitch(switches::kDisableDeviceOrientation)); | 953 !command_line.HasSwitch(switches::kDisableDeviceOrientation)); |
946 | 954 |
947 WebRuntimeFeatures::enableSpeechInput( | 955 WebRuntimeFeatures::enableSpeechInput(is_speech_input_enabled_); |
948 !command_line.HasSwitch(switches::kDisableSpeechInput)); | |
949 | 956 |
950 WebRuntimeFeatures::enableFileSystem( | 957 WebRuntimeFeatures::enableFileSystem( |
951 !command_line.HasSwitch(switches::kDisableFileSystem)); | 958 !command_line.HasSwitch(switches::kDisableFileSystem)); |
952 } | 959 } |
953 | 960 |
954 void RenderThread::IdleHandler() { | 961 void RenderThread::IdleHandler() { |
955 #if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) | 962 #if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) |
956 MallocExtension::instance()->ReleaseFreeMemory(); | 963 MallocExtension::instance()->ReleaseFreeMemory(); |
957 #endif | 964 #endif |
958 | 965 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 } | 1134 } |
1128 | 1135 |
1129 return false; | 1136 return false; |
1130 } | 1137 } |
1131 | 1138 |
1132 void RenderThread::RegisterExtension(v8::Extension* extension, | 1139 void RenderThread::RegisterExtension(v8::Extension* extension, |
1133 bool restrict_to_extensions) { | 1140 bool restrict_to_extensions) { |
1134 WebScriptController::registerExtension(extension); | 1141 WebScriptController::registerExtension(extension); |
1135 v8_extensions_[extension->name()] = restrict_to_extensions; | 1142 v8_extensions_[extension->name()] = restrict_to_extensions; |
1136 } | 1143 } |
OLD | NEW |