| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 if (RenderProcessImpl::InProcessPlugins()) | 239 if (RenderProcessImpl::InProcessPlugins()) |
| 240 CoInitialize(0); | 240 CoInitialize(0); |
| 241 #endif | 241 #endif |
| 242 | 242 |
| 243 std::string type_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 243 std::string type_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 244 switches::kProcessType); | 244 switches::kProcessType); |
| 245 // In single process the single process is all there is. | 245 // In single process the single process is all there is. |
| 246 is_extension_process_ = type_str == switches::kExtensionProcess || | 246 is_extension_process_ = type_str == switches::kExtensionProcess || |
| 247 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 247 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
| 248 is_incognito_process_ = false; | 248 is_incognito_process_ = false; |
| 249 is_speech_input_enabled_ = false; | |
| 250 suspend_webkit_shared_timer_ = true; | 249 suspend_webkit_shared_timer_ = true; |
| 251 notify_webkit_of_modal_loop_ = true; | 250 notify_webkit_of_modal_loop_ = true; |
| 252 plugin_refresh_allowed_ = true; | 251 plugin_refresh_allowed_ = true; |
| 253 cache_stats_task_pending_ = false; | 252 cache_stats_task_pending_ = false; |
| 254 widget_count_ = 0; | 253 widget_count_ = 0; |
| 255 hidden_widget_count_ = 0; | 254 hidden_widget_count_ = 0; |
| 256 idle_notification_delay_in_s_ = is_extension_process_ ? | 255 idle_notification_delay_in_s_ = is_extension_process_ ? |
| 257 kInitialExtensionIdleHandlerDelayS : kInitialIdleHandlerDelayS; | 256 kInitialExtensionIdleHandlerDelayS : kInitialIdleHandlerDelayS; |
| 258 task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this)); | 257 task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this)); |
| 259 | 258 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 OnSetIPCLoggingEnabled) | 637 OnSetIPCLoggingEnabled) |
| 639 #endif | 638 #endif |
| 640 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_Init, | 639 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_Init, |
| 641 OnInitSpellChecker) | 640 OnInitSpellChecker) |
| 642 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_WordAdded, | 641 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_WordAdded, |
| 643 OnSpellCheckWordAdded) | 642 OnSpellCheckWordAdded) |
| 644 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect, | 643 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect, |
| 645 OnSpellCheckEnableAutoSpellCorrect) | 644 OnSpellCheckEnableAutoSpellCorrect) |
| 646 IPC_MESSAGE_HANDLER(ViewMsg_GpuChannelEstablished, OnGpuChannelEstablished) | 645 IPC_MESSAGE_HANDLER(ViewMsg_GpuChannelEstablished, OnGpuChannelEstablished) |
| 647 IPC_MESSAGE_HANDLER(ViewMsg_SetPhishingModel, OnSetPhishingModel) | 646 IPC_MESSAGE_HANDLER(ViewMsg_SetPhishingModel, OnSetPhishingModel) |
| 648 IPC_MESSAGE_HANDLER(ViewMsg_SpeechInput_SetFeatureEnabled, | |
| 649 OnSetSpeechInputEnabled) | |
| 650 IPC_MESSAGE_UNHANDLED(handled = false) | 647 IPC_MESSAGE_UNHANDLED(handled = false) |
| 651 IPC_END_MESSAGE_MAP() | 648 IPC_END_MESSAGE_MAP() |
| 652 return handled; | 649 return handled; |
| 653 } | 650 } |
| 654 | 651 |
| 655 void RenderThread::OnSetSpeechInputEnabled(bool enabled) { | |
| 656 DCHECK(!webkit_client_.get()); | |
| 657 is_speech_input_enabled_ = enabled; | |
| 658 } | |
| 659 | |
| 660 void RenderThread::OnSetNextPageID(int32 next_page_id) { | 652 void RenderThread::OnSetNextPageID(int32 next_page_id) { |
| 661 // This should only be called at process initialization time, so we shouldn't | 653 // This should only be called at process initialization time, so we shouldn't |
| 662 // have to worry about thread-safety. | 654 // have to worry about thread-safety. |
| 663 RenderView::SetNextPageID(next_page_id); | 655 RenderView::SetNextPageID(next_page_id); |
| 664 } | 656 } |
| 665 | 657 |
| 666 // Called when to register CSS Color name->system color mappings. | 658 // Called when to register CSS Color name->system color mappings. |
| 667 // We update the colors one by one and then tell WebKit to refresh all render | 659 // We update the colors one by one and then tell WebKit to refresh all render |
| 668 // views. | 660 // views. |
| 669 void RenderThread::OnSetCSSColors( | 661 void RenderThread::OnSetCSSColors( |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 | 944 |
| 953 WebRuntimeFeatures::enableTouch( | 945 WebRuntimeFeatures::enableTouch( |
| 954 command_line.HasSwitch(switches::kEnableTouch)); | 946 command_line.HasSwitch(switches::kEnableTouch)); |
| 955 | 947 |
| 956 WebRuntimeFeatures::enableDeviceMotion( | 948 WebRuntimeFeatures::enableDeviceMotion( |
| 957 command_line.HasSwitch(switches::kEnableDeviceMotion)); | 949 command_line.HasSwitch(switches::kEnableDeviceMotion)); |
| 958 | 950 |
| 959 WebRuntimeFeatures::enableDeviceOrientation( | 951 WebRuntimeFeatures::enableDeviceOrientation( |
| 960 !command_line.HasSwitch(switches::kDisableDeviceOrientation)); | 952 !command_line.HasSwitch(switches::kDisableDeviceOrientation)); |
| 961 | 953 |
| 962 WebRuntimeFeatures::enableSpeechInput(is_speech_input_enabled_); | 954 WebRuntimeFeatures::enableSpeechInput( |
| 955 !command_line.HasSwitch(switches::kDisableSpeechInput)); |
| 963 | 956 |
| 964 WebRuntimeFeatures::enableFileSystem( | 957 WebRuntimeFeatures::enableFileSystem( |
| 965 !command_line.HasSwitch(switches::kDisableFileSystem)); | 958 !command_line.HasSwitch(switches::kDisableFileSystem)); |
| 966 | 959 |
| 967 WebRuntimeFeatures::enableJavaScriptI18NAPI( | 960 WebRuntimeFeatures::enableJavaScriptI18NAPI( |
| 968 command_line.HasSwitch(switches::kEnableJavaScriptI18NAPI)); | 961 command_line.HasSwitch(switches::kEnableJavaScriptI18NAPI)); |
| 969 } | 962 } |
| 970 | 963 |
| 971 void RenderThread::IdleHandler() { | 964 void RenderThread::IdleHandler() { |
| 972 #if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) | 965 #if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 } | 1126 } |
| 1134 | 1127 |
| 1135 return false; | 1128 return false; |
| 1136 } | 1129 } |
| 1137 | 1130 |
| 1138 void RenderThread::RegisterExtension(v8::Extension* extension, | 1131 void RenderThread::RegisterExtension(v8::Extension* extension, |
| 1139 bool restrict_to_extensions) { | 1132 bool restrict_to_extensions) { |
| 1140 WebScriptController::registerExtension(extension); | 1133 WebScriptController::registerExtension(extension); |
| 1141 v8_extensions_[extension->name()] = restrict_to_extensions; | 1134 v8_extensions_[extension->name()] = restrict_to_extensions; |
| 1142 } | 1135 } |
| OLD | NEW |