Chromium Code Reviews| Index: content/browser/web_contents/touch_editable_impl_aura.cc |
| =================================================================== |
| --- content/browser/web_contents/touch_editable_impl_aura.cc (revision 254898) |
| +++ content/browser/web_contents/touch_editable_impl_aura.cc (working copy) |
| @@ -4,6 +4,7 @@ |
| #include "content/browser/web_contents/touch_editable_impl_aura.h" |
| +#include "content/browser/frame_host/render_frame_host_impl.h" |
| #include "content/browser/renderer_host/render_widget_host_impl.h" |
| #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| #include "content/common/view_messages.h" |
| @@ -221,6 +222,12 @@ |
| Cleanup(); |
| } |
| +void TouchEditableImplAura::SetContextMenuRenderFrameID( |
| + int render_process_id, int render_frame_id) { |
|
nasko
2014/03/05 21:50:47
style: params should be on separate lines.
jam
2014/03/06 00:59:37
Done.
|
| + menu_render_process_id_ = render_process_id; |
| + menu_render_frame_id_ = render_frame_id; |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // TouchEditableImplAura, ui::TouchEditable implementation: |
| @@ -290,6 +297,8 @@ |
| RenderWidgetHost* host = rwhva_->GetRenderWidgetHost(); |
| host->Send(new ViewMsg_ShowContextMenu(host->GetRoutingID(), point)); |
| EndTouchEditing(false); |
| + menu_render_process_id_ = MSG_ROUTING_NONE; |
| + menu_render_frame_id_ = MSG_ROUTING_NONE; |
| } |
| bool TouchEditableImplAura::IsCommandIdChecked(int command_id) const { |
| @@ -334,15 +343,23 @@ |
| if (!rwhva_) |
| return; |
| RenderWidgetHost* host = rwhva_->GetRenderWidgetHost(); |
| + |
| + DCHECK_NE(menu_render_process_id_ , MSG_ROUTING_NONE); |
| + DCHECK_NE(menu_render_frame_id_, MSG_ROUTING_NONE); |
| + RenderFrameHostImpl* frame = RenderFrameHostImpl::FromID( |
| + menu_render_process_id_, menu_render_frame_id_); |
| switch (command_id) { |
| case IDS_APP_CUT: |
| - host->Cut(); |
| + if (frame) |
| + frame->Cut(); |
| break; |
| case IDS_APP_COPY: |
| - host->Copy(); |
| + if (frame) |
| + frame->Copy(); |
| break; |
| case IDS_APP_PASTE: |
| - host->Paste(); |
| + if (frame) |
| + frame->Paste(); |
| break; |
| case IDS_APP_DELETE: |
| host->Delete(); |
| @@ -363,6 +380,8 @@ |
| TouchEditableImplAura::TouchEditableImplAura() |
| : text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| rwhva_(NULL), |
| + menu_render_process_id_(MSG_ROUTING_NONE), |
| + menu_render_frame_id_(MSG_ROUTING_NONE), |
| selection_gesture_in_process_(false), |
| handles_hidden_due_to_scroll_(false), |
| scroll_in_progress_(false), |