| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 render_view_->Send( | 1132 render_view_->Send( |
| 1133 new PpapiHostMsg_PPBX509Certificate_ParseDER(der, &succeeded, fields)); | 1133 new PpapiHostMsg_PPBX509Certificate_ParseDER(der, &succeeded, fields)); |
| 1134 return succeeded; | 1134 return succeeded; |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 int32_t PepperPluginDelegateImpl::ShowContextMenu( | 1137 int32_t PepperPluginDelegateImpl::ShowContextMenu( |
| 1138 webkit::ppapi::PluginInstance* instance, | 1138 webkit::ppapi::PluginInstance* instance, |
| 1139 webkit::ppapi::PPB_Flash_Menu_Impl* menu, | 1139 webkit::ppapi::PPB_Flash_Menu_Impl* menu, |
| 1140 const gfx::Point& position) { | 1140 const gfx::Point& position) { |
| 1141 int32 render_widget_id = render_view_->routing_id(); | 1141 int32 render_widget_id = render_view_->routing_id(); |
| 1142 if (instance->FlashIsFullscreen(instance->pp_instance())) { | 1142 if (instance->flash_fullscreen()) { |
| 1143 webkit::ppapi::FullscreenContainer* container = | 1143 webkit::ppapi::FullscreenContainer* container = |
| 1144 instance->fullscreen_container(); | 1144 instance->fullscreen_container(); |
| 1145 DCHECK(container); | 1145 DCHECK(container); |
| 1146 render_widget_id = | 1146 render_widget_id = |
| 1147 static_cast<RenderWidgetFullscreenPepper*>(container)->routing_id(); | 1147 static_cast<RenderWidgetFullscreenPepper*>(container)->routing_id(); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 int request_id = pending_context_menus_.Add( | 1150 int request_id = pending_context_menus_.Add( |
| 1151 new scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>(menu)); | 1151 new scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>(menu)); |
| 1152 | 1152 |
| 1153 ContextMenuParams params; | 1153 ContextMenuParams params; |
| 1154 params.x = position.x(); | 1154 params.x = position.x(); |
| 1155 params.y = position.y(); | 1155 params.y = position.y(); |
| 1156 params.custom_context.is_pepper_menu = true; | 1156 params.custom_context.is_pepper_menu = true; |
| 1157 params.custom_context.request_id = request_id; | 1157 params.custom_context.request_id = request_id; |
| 1158 params.custom_context.render_widget_id = render_widget_id; | 1158 params.custom_context.render_widget_id = render_widget_id; |
| 1159 params.custom_items = menu->menu_data(); | 1159 params.custom_items = menu->menu_data(); |
| 1160 | 1160 |
| 1161 // Transform the position to be in render view's coordinates. | 1161 // Transform the position to be in render view's coordinates. |
| 1162 if (instance->view_data().is_fullscreen || | 1162 if (instance->view_data().is_fullscreen || instance->flash_fullscreen()) { |
| 1163 instance->FlashIsFullscreen(instance->pp_instance())) { | |
| 1164 WebKit::WebRect rect = render_view_->windowRect(); | 1163 WebKit::WebRect rect = render_view_->windowRect(); |
| 1165 params.x -= rect.x; | 1164 params.x -= rect.x; |
| 1166 params.y -= rect.y; | 1165 params.y -= rect.y; |
| 1167 } else { | 1166 } else { |
| 1168 params.x += instance->view_data().rect.point.x; | 1167 params.x += instance->view_data().rect.point.x; |
| 1169 params.y += instance->view_data().rect.point.y; | 1168 params.y += instance->view_data().rect.point.y; |
| 1170 } | 1169 } |
| 1171 | 1170 |
| 1172 IPC::Message* msg = new ViewHostMsg_ContextMenu(render_view_->routing_id(), | 1171 IPC::Message* msg = new ViewHostMsg_ContextMenu(render_view_->routing_id(), |
| 1173 params); | 1172 params); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 #endif | 1267 #endif |
| 1269 } | 1268 } |
| 1270 | 1269 |
| 1271 double PepperPluginDelegateImpl::GetLocalTimeZoneOffset(base::Time t) { | 1270 double PepperPluginDelegateImpl::GetLocalTimeZoneOffset(base::Time t) { |
| 1272 double result = 0.0; | 1271 double result = 0.0; |
| 1273 render_view_->Send(new PepperMsg_GetLocalTimeZoneOffset( | 1272 render_view_->Send(new PepperMsg_GetLocalTimeZoneOffset( |
| 1274 t, &result)); | 1273 t, &result)); |
| 1275 return result; | 1274 return result; |
| 1276 } | 1275 } |
| 1277 | 1276 |
| 1278 std::string PepperPluginDelegateImpl::GetFlashCommandLineArgs() { | |
| 1279 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 1280 switches::kPpapiFlashArgs); | |
| 1281 } | |
| 1282 | |
| 1283 base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory( | 1277 base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory( |
| 1284 uint32_t size) { | 1278 uint32_t size) { |
| 1285 if (size == 0) | 1279 if (size == 0) |
| 1286 return NULL; | 1280 return NULL; |
| 1287 base::SharedMemoryHandle handle; | 1281 base::SharedMemoryHandle handle; |
| 1288 if (!render_view_->Send( | 1282 if (!render_view_->Send( |
| 1289 new ChildProcessHostMsg_SyncAllocateSharedMemory(size, &handle))) { | 1283 new ChildProcessHostMsg_SyncAllocateSharedMemory(size, &handle))) { |
| 1290 DLOG(WARNING) << "Browser allocation request message failed"; | 1284 DLOG(WARNING) << "Browser allocation request message failed"; |
| 1291 return NULL; | 1285 return NULL; |
| 1292 } | 1286 } |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 mouse_lock_instances_.erase(it); | 1616 mouse_lock_instances_.erase(it); |
| 1623 } | 1617 } |
| 1624 } | 1618 } |
| 1625 | 1619 |
| 1626 webkit_glue::ClipboardClient* | 1620 webkit_glue::ClipboardClient* |
| 1627 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1621 PepperPluginDelegateImpl::CreateClipboardClient() const { |
| 1628 return new RendererClipboardClient; | 1622 return new RendererClipboardClient; |
| 1629 } | 1623 } |
| 1630 | 1624 |
| 1631 } // namespace content | 1625 } // namespace content |
| OLD | NEW |