| 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/tab_contents/render_view_context_menu_gtk.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 menu_gtk_.reset(new MenuGtk(this, &menu_model_)); | 27 menu_gtk_.reset(new MenuGtk(this, &menu_model_)); |
| 28 | 28 |
| 29 if (params_.is_editable) { | 29 if (params_.is_editable) { |
| 30 RenderWidgetHostViewGtk* rwhv = static_cast<RenderWidgetHostViewGtk*>( | 30 RenderWidgetHostViewGtk* rwhv = static_cast<RenderWidgetHostViewGtk*>( |
| 31 source_tab_contents_->GetRenderWidgetHostView()); | 31 source_tab_contents_->GetRenderWidgetHostView()); |
| 32 if (rwhv) | 32 if (rwhv) |
| 33 rwhv->AppendInputMethodsContextMenu(menu_gtk_.get()); | 33 rwhv->AppendInputMethodsContextMenu(menu_gtk_.get()); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool RenderViewContextMenuGtk::GetAcceleratorForCommandId( |
| 38 int command_id, |
| 39 menus::Accelerator* accelerator) { |
| 40 return false; |
| 41 } |
| 42 |
| 37 void RenderViewContextMenuGtk::Popup(const gfx::Point& point) { | 43 void RenderViewContextMenuGtk::Popup(const gfx::Point& point) { |
| 38 RenderWidgetHostView* rwhv = source_tab_contents_->GetRenderWidgetHostView(); | 44 RenderWidgetHostView* rwhv = source_tab_contents_->GetRenderWidgetHostView(); |
| 39 if (rwhv) | 45 if (rwhv) |
| 40 rwhv->ShowingContextMenu(true); | 46 rwhv->ShowingContextMenu(true); |
| 41 menu_gtk_->PopupAsContextAt(triggering_event_time_, point); | 47 menu_gtk_->PopupAsContextAt(triggering_event_time_, point); |
| 42 } | 48 } |
| 43 | 49 |
| 44 void RenderViewContextMenuGtk::StoppedShowing() { | 50 void RenderViewContextMenuGtk::StoppedShowing() { |
| 45 RenderWidgetHostView* rwhv = source_tab_contents_->GetRenderWidgetHostView(); | 51 RenderWidgetHostView* rwhv = source_tab_contents_->GetRenderWidgetHostView(); |
| 46 if (rwhv) | 52 if (rwhv) |
| 47 rwhv->ShowingContextMenu(false); | 53 rwhv->ShowingContextMenu(false); |
| 48 } | 54 } |
| 49 | 55 |
| 50 bool RenderViewContextMenuGtk::AlwaysShowIconForCmd(int command_id) const { | 56 bool RenderViewContextMenuGtk::AlwaysShowIconForCmd(int command_id) const { |
| 51 return command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && | 57 return command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && |
| 52 command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST; | 58 command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST; |
| 53 } | 59 } |
| OLD | NEW |