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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/histogram.h" | 8 #include "base/histogram.h" |
9 #include "base/keyboard_codes.h" | 9 #include "base/keyboard_codes.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 #if defined(OS_LINUX) | 136 #if defined(OS_LINUX) |
137 IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, | 137 IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, |
138 OnMsgCreatePluginContainer) | 138 OnMsgCreatePluginContainer) |
139 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, | 139 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, |
140 OnMsgDestroyPluginContainer) | 140 OnMsgDestroyPluginContainer) |
141 #elif defined(OS_MACOSX) | 141 #elif defined(OS_MACOSX) |
142 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) | 142 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) |
143 IPC_MESSAGE_HANDLER(ViewHostMsg_GetScreenInfo, OnMsgGetScreenInfo) | 143 IPC_MESSAGE_HANDLER(ViewHostMsg_GetScreenInfo, OnMsgGetScreenInfo) |
144 IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnMsgGetWindowRect) | 144 IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnMsgGetWindowRect) |
145 IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnMsgGetRootWindowRect) | 145 IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnMsgGetRootWindowRect) |
| 146 // The following messages are only used on 10.6 and later |
| 147 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateFakePluginWindowHandle, |
| 148 OnAllocateFakePluginWindowHandle) |
| 149 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyFakePluginWindowHandle, |
| 150 OnDestroyFakePluginWindowHandle) |
| 151 IPC_MESSAGE_HANDLER(ViewHostMsg_GPUPluginSetIOSurface, |
| 152 OnGPUPluginSetIOSurface) |
| 153 IPC_MESSAGE_HANDLER(ViewHostMsg_GPUPluginBuffersSwapped, |
| 154 OnGPUPluginBuffersSwapped) |
146 #endif | 155 #endif |
147 IPC_MESSAGE_UNHANDLED_ERROR() | 156 IPC_MESSAGE_UNHANDLED_ERROR() |
148 IPC_END_MESSAGE_MAP_EX() | 157 IPC_END_MESSAGE_MAP_EX() |
149 | 158 |
150 if (!msg_is_ok) { | 159 if (!msg_is_ok) { |
151 // The message de-serialization failed. Kill the renderer process. | 160 // The message de-serialization failed. Kill the renderer process. |
152 process()->ReceivedBadMessage(msg.type()); | 161 process()->ReceivedBadMessage(msg.type()); |
153 } | 162 } |
154 } | 163 } |
155 | 164 |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 } | 876 } |
868 } | 877 } |
869 | 878 |
870 void RenderWidgetHost::OnMsgGetRootWindowRect(gfx::NativeViewId window_id, | 879 void RenderWidgetHost::OnMsgGetRootWindowRect(gfx::NativeViewId window_id, |
871 gfx::Rect* results) { | 880 gfx::Rect* results) { |
872 if (view_) { | 881 if (view_) { |
873 *results = view_->GetRootWindowRect(); | 882 *results = view_->GetRootWindowRect(); |
874 } | 883 } |
875 } | 884 } |
876 | 885 |
| 886 void RenderWidgetHost::OnAllocateFakePluginWindowHandle( |
| 887 gfx::PluginWindowHandle* id) { |
| 888 // TODO(kbr): similar potential issue here as in OnMsgCreatePluginContainer. |
| 889 // Possibly less of an issue because this is only used for the GPU plugin. |
| 890 if (view_) { |
| 891 *id = view_->AllocateFakePluginWindowHandle(); |
| 892 } else { |
| 893 NOTIMPLEMENTED(); |
| 894 } |
| 895 } |
| 896 |
| 897 void RenderWidgetHost::OnDestroyFakePluginWindowHandle( |
| 898 gfx::PluginWindowHandle id) { |
| 899 if (view_) { |
| 900 view_->DestroyFakePluginWindowHandle(id); |
| 901 } else { |
| 902 NOTIMPLEMENTED(); |
| 903 } |
| 904 } |
| 905 |
| 906 void RenderWidgetHost::OnGPUPluginSetIOSurface(gfx::PluginWindowHandle window, |
| 907 int32 width, |
| 908 int32 height, |
| 909 uint64 mach_port) { |
| 910 if (view_) { |
| 911 view_->GPUPluginSetIOSurface(window, width, height, mach_port); |
| 912 } |
| 913 } |
| 914 |
| 915 void RenderWidgetHost::OnGPUPluginBuffersSwapped( |
| 916 gfx::PluginWindowHandle window) { |
| 917 if (view_) { |
| 918 view_->GPUPluginBuffersSwapped(window); |
| 919 } |
| 920 } |
877 #endif | 921 #endif |
878 | 922 |
879 void RenderWidgetHost::PaintBackingStoreRect( | 923 void RenderWidgetHost::PaintBackingStoreRect( |
880 TransportDIB::Id bitmap, | 924 TransportDIB::Id bitmap, |
881 const gfx::Rect& bitmap_rect, | 925 const gfx::Rect& bitmap_rect, |
882 const std::vector<gfx::Rect>& copy_rects, | 926 const std::vector<gfx::Rect>& copy_rects, |
883 const gfx::Size& view_size, | 927 const gfx::Size& view_size, |
884 bool* painted_synchronously) { | 928 bool* painted_synchronously) { |
885 // On failure, we need to be sure our caller knows we're done with the | 929 // On failure, we need to be sure our caller knows we're done with the |
886 // backing store. | 930 // backing store. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 | 1004 |
961 if (!processed) { | 1005 if (!processed) { |
962 UnhandledKeyboardEvent(front_item); | 1006 UnhandledKeyboardEvent(front_item); |
963 | 1007 |
964 // WARNING: This RenderWidgetHost can be deallocated at this point | 1008 // WARNING: This RenderWidgetHost can be deallocated at this point |
965 // (i.e. in the case of Ctrl+W, where the call to | 1009 // (i.e. in the case of Ctrl+W, where the call to |
966 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1010 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
967 } | 1011 } |
968 } | 1012 } |
969 } | 1013 } |
OLD | NEW |