Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu_gtk.cc

Issue 7669040: content: Move render_widget_host_view_gtk to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chromeos fix. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" 11 #include "chrome/browser/ui/gtk/gtk_util.h"
12 #include "content/browser/renderer_host/render_widget_host_view_gtk.h"
12 #include "content/browser/tab_contents/tab_contents.h" 13 #include "content/browser/tab_contents/tab_contents.h"
14 #include "grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/gfx/gtk_util.h"
13 #include "webkit/glue/context_menu.h" 17 #include "webkit/glue/context_menu.h"
14 18
15 RenderViewContextMenuGtk::RenderViewContextMenuGtk( 19 RenderViewContextMenuGtk::RenderViewContextMenuGtk(
16 TabContents* web_contents, 20 TabContents* web_contents,
17 const ContextMenuParams& params, 21 const ContextMenuParams& params,
18 guint32 triggering_event_time) 22 guint32 triggering_event_time)
19 : RenderViewContextMenu(web_contents, params), 23 : RenderViewContextMenu(web_contents, params),
20 triggering_event_time_(triggering_event_time) { 24 triggering_event_time_(triggering_event_time) {
21 } 25 }
22 26
23 RenderViewContextMenuGtk::~RenderViewContextMenuGtk() { 27 RenderViewContextMenuGtk::~RenderViewContextMenuGtk() {
24 } 28 }
25 29
26 void RenderViewContextMenuGtk::PlatformInit() { 30 void RenderViewContextMenuGtk::PlatformInit() {
27 menu_gtk_.reset(new MenuGtk(this, &menu_model_)); 31 menu_gtk_.reset(new MenuGtk(this, &menu_model_));
28 32
29 if (params_.is_editable) { 33 if (params_.is_editable) {
30 RenderWidgetHostViewGtk* rwhv = static_cast<RenderWidgetHostViewGtk*>( 34 RenderWidgetHostViewGtk* rwhv = static_cast<RenderWidgetHostViewGtk*>(
31 source_tab_contents_->GetRenderWidgetHostView()); 35 source_tab_contents_->GetRenderWidgetHostView());
32 if (rwhv) 36 #if !defined(TOOLKIT_VIEWS)
33 rwhv->AppendInputMethodsContextMenu(menu_gtk_.get()); 37 if (rwhv) {
38 MenuGtk* menu = menu_gtk_.get();
39 gboolean show_input_method_menu = TRUE;
40
41 g_object_get(
42 gtk_widget_get_settings(GTK_WIDGET(rwhv->native_view())),
43 "gtk-show-input-method-menu", &show_input_method_menu, NULL);
44 if (!show_input_method_menu)
45 return;
46
47 std::string label = gfx::ConvertAcceleratorsFromWindowsStyle(
48 l10n_util::GetStringUTF8(IDS_CONTENT_CONTEXT_INPUT_METHODS_MENU));
49 GtkWidget* menuitem = gtk_menu_item_new_with_mnemonic(label.c_str());
50 GtkWidget* submenu = rwhv->BuildInputMethodsGtkMenu();
51 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
52 menu->AppendSeparator();
53 menu->AppendMenuItem(IDC_INPUT_METHODS_MENU, menuitem);
54 }
55 #endif
34 } 56 }
35 } 57 }
36 58
37 bool RenderViewContextMenuGtk::GetAcceleratorForCommandId( 59 bool RenderViewContextMenuGtk::GetAcceleratorForCommandId(
38 int command_id, 60 int command_id,
39 ui::Accelerator* accelerator) { 61 ui::Accelerator* accelerator) {
40 return false; 62 return false;
41 } 63 }
42 64
43 void RenderViewContextMenuGtk::Popup(const gfx::Point& point) { 65 void RenderViewContextMenuGtk::Popup(const gfx::Point& point) {
44 menu_gtk_->PopupAsContext(point, triggering_event_time_); 66 menu_gtk_->PopupAsContext(point, triggering_event_time_);
45 } 67 }
46 68
47 bool RenderViewContextMenuGtk::AlwaysShowIconForCmd(int command_id) const { 69 bool RenderViewContextMenuGtk::AlwaysShowIconForCmd(int command_id) const {
48 return command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && 70 return command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST &&
49 command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST; 71 command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST;
50 } 72 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.cc ('k') | chrome/browser/tab_contents/tab_contents_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698