| 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/browser/renderer_host/render_widget_host.h" | 5 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) | 157 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) |
| 158 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) | 158 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) |
| 159 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) | 159 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) |
| 160 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateTextInputState, | 160 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateTextInputState, |
| 161 OnMsgImeUpdateTextInputState) | 161 OnMsgImeUpdateTextInputState) |
| 162 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, | 162 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, |
| 163 OnMsgImeCancelComposition) | 163 OnMsgImeCancelComposition) |
| 164 IPC_MESSAGE_HANDLER(ViewHostMsg_GpuRenderingActivated, | 164 IPC_MESSAGE_HANDLER(ViewHostMsg_GpuRenderingActivated, |
| 165 OnMsgGpuRenderingActivated) | 165 OnMsgGpuRenderingActivated) |
| 166 #if defined(OS_MACOSX) | 166 #if defined(OS_MACOSX) |
| 167 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) | |
| 168 IPC_MESSAGE_HANDLER(ViewHostMsg_GetScreenInfo, OnMsgGetScreenInfo) | 167 IPC_MESSAGE_HANDLER(ViewHostMsg_GetScreenInfo, OnMsgGetScreenInfo) |
| 169 IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnMsgGetWindowRect) | 168 IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnMsgGetWindowRect) |
| 170 IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnMsgGetRootWindowRect) | 169 IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnMsgGetRootWindowRect) |
| 171 IPC_MESSAGE_HANDLER(ViewHostMsg_SetPluginImeEnabled, | 170 IPC_MESSAGE_HANDLER(ViewHostMsg_SetPluginImeEnabled, |
| 172 OnMsgSetPluginImeEnabled) | 171 OnMsgSetPluginImeEnabled) |
| 173 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateFakePluginWindowHandle, | 172 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateFakePluginWindowHandle, |
| 174 OnAllocateFakePluginWindowHandle) | 173 OnAllocateFakePluginWindowHandle) |
| 175 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyFakePluginWindowHandle, | 174 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyFakePluginWindowHandle, |
| 176 OnDestroyFakePluginWindowHandle) | 175 OnDestroyFakePluginWindowHandle) |
| 177 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetIOSurface, | 176 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetIOSurface, |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 #endif | 970 #endif |
| 972 is_gpu_rendering_active_ = activated; | 971 is_gpu_rendering_active_ = activated; |
| 973 #if defined(OS_MACOSX) | 972 #if defined(OS_MACOSX) |
| 974 if (old_state != is_gpu_rendering_active_ && view_) | 973 if (old_state != is_gpu_rendering_active_ && view_) |
| 975 view_->GpuRenderingStateDidChange(); | 974 view_->GpuRenderingStateDidChange(); |
| 976 #endif | 975 #endif |
| 977 } | 976 } |
| 978 | 977 |
| 979 #if defined(OS_MACOSX) | 978 #if defined(OS_MACOSX) |
| 980 | 979 |
| 981 void RenderWidgetHost::OnMsgShowPopup( | |
| 982 const ViewHostMsg_ShowPopup_Params& params) { | |
| 983 view_->ShowPopupWithItems(params.bounds, | |
| 984 params.item_height, | |
| 985 params.item_font_size, | |
| 986 params.selected_item, | |
| 987 params.popup_items, | |
| 988 params.right_aligned); | |
| 989 } | |
| 990 | |
| 991 void RenderWidgetHost::OnMsgGetScreenInfo(gfx::NativeViewId view, | 980 void RenderWidgetHost::OnMsgGetScreenInfo(gfx::NativeViewId view, |
| 992 WebScreenInfo* results) { | 981 WebScreenInfo* results) { |
| 993 gfx::NativeView native_view = view_ ? view_->GetNativeView() : NULL; | 982 gfx::NativeView native_view = view_ ? view_->GetNativeView() : NULL; |
| 994 *results = WebScreenInfoFactory::screenInfo(native_view); | 983 *results = WebScreenInfoFactory::screenInfo(native_view); |
| 995 } | 984 } |
| 996 | 985 |
| 997 void RenderWidgetHost::OnMsgGetWindowRect(gfx::NativeViewId window_id, | 986 void RenderWidgetHost::OnMsgGetWindowRect(gfx::NativeViewId window_id, |
| 998 gfx::Rect* results) { | 987 gfx::Rect* results) { |
| 999 if (view_) { | 988 if (view_) { |
| 1000 *results = view_->GetWindowRect(); | 989 *results = view_->GetWindowRect(); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 // of this key event. | 1214 // of this key event. |
| 1226 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { | 1215 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { |
| 1227 UnhandledKeyboardEvent(front_item); | 1216 UnhandledKeyboardEvent(front_item); |
| 1228 | 1217 |
| 1229 // WARNING: This RenderWidgetHost can be deallocated at this point | 1218 // WARNING: This RenderWidgetHost can be deallocated at this point |
| 1230 // (i.e. in the case of Ctrl+W, where the call to | 1219 // (i.e. in the case of Ctrl+W, where the call to |
| 1231 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1220 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
| 1232 } | 1221 } |
| 1233 } | 1222 } |
| 1234 } | 1223 } |
| OLD | NEW |