| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 if (RenderProcessImpl::InProcessPlugins()) | 261 if (RenderProcessImpl::InProcessPlugins()) |
| 262 CoInitialize(0); | 262 CoInitialize(0); |
| 263 #endif | 263 #endif |
| 264 | 264 |
| 265 std::string type_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 265 std::string type_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 266 switches::kProcessType); | 266 switches::kProcessType); |
| 267 // In single process the single process is all there is. | 267 // In single process the single process is all there is. |
| 268 is_extension_process_ = type_str == switches::kExtensionProcess || | 268 is_extension_process_ = type_str == switches::kExtensionProcess || |
| 269 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 269 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
| 270 is_incognito_process_ = false; | 270 is_incognito_process_ = false; |
| 271 is_speech_input_enabled_ = false; | |
| 272 suspend_webkit_shared_timer_ = true; | 271 suspend_webkit_shared_timer_ = true; |
| 273 notify_webkit_of_modal_loop_ = true; | 272 notify_webkit_of_modal_loop_ = true; |
| 274 plugin_refresh_allowed_ = true; | 273 plugin_refresh_allowed_ = true; |
| 275 cache_stats_task_pending_ = false; | 274 cache_stats_task_pending_ = false; |
| 276 widget_count_ = 0; | 275 widget_count_ = 0; |
| 277 hidden_widget_count_ = 0; | 276 hidden_widget_count_ = 0; |
| 278 idle_notification_delay_in_s_ = is_extension_process_ ? | 277 idle_notification_delay_in_s_ = is_extension_process_ ? |
| 279 kInitialExtensionIdleHandlerDelayS : kInitialIdleHandlerDelayS; | 278 kInitialExtensionIdleHandlerDelayS : kInitialIdleHandlerDelayS; |
| 280 task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this)); | 279 task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this)); |
| 281 callback_factory_.reset(new base::ScopedCallbackFactory<RenderThread>(this)); | 280 callback_factory_.reset(new base::ScopedCallbackFactory<RenderThread>(this)); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 OnSetIPCLoggingEnabled) | 651 OnSetIPCLoggingEnabled) |
| 653 #endif | 652 #endif |
| 654 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_Init, | 653 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_Init, |
| 655 OnInitSpellChecker) | 654 OnInitSpellChecker) |
| 656 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_WordAdded, | 655 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_WordAdded, |
| 657 OnSpellCheckWordAdded) | 656 OnSpellCheckWordAdded) |
| 658 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect, | 657 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect, |
| 659 OnSpellCheckEnableAutoSpellCorrect) | 658 OnSpellCheckEnableAutoSpellCorrect) |
| 660 IPC_MESSAGE_HANDLER(ViewMsg_GpuChannelEstablished, OnGpuChannelEstablished) | 659 IPC_MESSAGE_HANDLER(ViewMsg_GpuChannelEstablished, OnGpuChannelEstablished) |
| 661 IPC_MESSAGE_HANDLER(ViewMsg_SetPhishingModel, OnSetPhishingModel) | 660 IPC_MESSAGE_HANDLER(ViewMsg_SetPhishingModel, OnSetPhishingModel) |
| 662 IPC_MESSAGE_HANDLER(ViewMsg_SpeechInput_SetFeatureEnabled, | |
| 663 OnSetSpeechInputEnabled) | |
| 664 IPC_MESSAGE_UNHANDLED(handled = false) | 661 IPC_MESSAGE_UNHANDLED(handled = false) |
| 665 IPC_END_MESSAGE_MAP() | 662 IPC_END_MESSAGE_MAP() |
| 666 return handled; | 663 return handled; |
| 667 } | 664 } |
| 668 | 665 |
| 669 void RenderThread::OnSetSpeechInputEnabled(bool enabled) { | |
| 670 DCHECK(!webkit_client_.get()); | |
| 671 is_speech_input_enabled_ = enabled; | |
| 672 } | |
| 673 | |
| 674 void RenderThread::OnSetNextPageID(int32 next_page_id) { | 666 void RenderThread::OnSetNextPageID(int32 next_page_id) { |
| 675 // This should only be called at process initialization time, so we shouldn't | 667 // This should only be called at process initialization time, so we shouldn't |
| 676 // have to worry about thread-safety. | 668 // have to worry about thread-safety. |
| 677 RenderView::SetNextPageID(next_page_id); | 669 RenderView::SetNextPageID(next_page_id); |
| 678 } | 670 } |
| 679 | 671 |
| 680 // Called when to register CSS Color name->system color mappings. | 672 // Called when to register CSS Color name->system color mappings. |
| 681 // We update the colors one by one and then tell WebKit to refresh all render | 673 // We update the colors one by one and then tell WebKit to refresh all render |
| 682 // views. | 674 // views. |
| 683 void RenderThread::OnSetCSSColors( | 675 void RenderThread::OnSetCSSColors( |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 | 953 |
| 962 WebRuntimeFeatures::enableTouch( | 954 WebRuntimeFeatures::enableTouch( |
| 963 command_line.HasSwitch(switches::kEnableTouch)); | 955 command_line.HasSwitch(switches::kEnableTouch)); |
| 964 | 956 |
| 965 WebRuntimeFeatures::enableDeviceMotion( | 957 WebRuntimeFeatures::enableDeviceMotion( |
| 966 command_line.HasSwitch(switches::kEnableDeviceMotion)); | 958 command_line.HasSwitch(switches::kEnableDeviceMotion)); |
| 967 | 959 |
| 968 WebRuntimeFeatures::enableDeviceOrientation( | 960 WebRuntimeFeatures::enableDeviceOrientation( |
| 969 !command_line.HasSwitch(switches::kDisableDeviceOrientation)); | 961 !command_line.HasSwitch(switches::kDisableDeviceOrientation)); |
| 970 | 962 |
| 971 WebRuntimeFeatures::enableSpeechInput(is_speech_input_enabled_); | 963 WebRuntimeFeatures::enableSpeechInput( |
| 964 !command_line.HasSwitch(switches::kDisableSpeechInput)); |
| 972 | 965 |
| 973 WebRuntimeFeatures::enableFileSystem( | 966 WebRuntimeFeatures::enableFileSystem( |
| 974 !command_line.HasSwitch(switches::kDisableFileSystem)); | 967 !command_line.HasSwitch(switches::kDisableFileSystem)); |
| 975 } | 968 } |
| 976 | 969 |
| 977 void RenderThread::IdleHandler() { | 970 void RenderThread::IdleHandler() { |
| 978 #if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) | 971 #if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) |
| 979 MallocExtension::instance()->ReleaseFreeMemory(); | 972 MallocExtension::instance()->ReleaseFreeMemory(); |
| 980 #endif | 973 #endif |
| 981 | 974 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 } | 1143 } |
| 1151 | 1144 |
| 1152 return false; | 1145 return false; |
| 1153 } | 1146 } |
| 1154 | 1147 |
| 1155 void RenderThread::RegisterExtension(v8::Extension* extension, | 1148 void RenderThread::RegisterExtension(v8::Extension* extension, |
| 1156 bool restrict_to_extensions) { | 1149 bool restrict_to_extensions) { |
| 1157 WebScriptController::registerExtension(extension); | 1150 WebScriptController::registerExtension(extension); |
| 1158 v8_extensions_[extension->name()] = restrict_to_extensions; | 1151 v8_extensions_[extension->name()] = restrict_to_extensions; |
| 1159 } | 1152 } |
| OLD | NEW |