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

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

Issue 10316013: linux: Move linux_util.h from gfx/ to ui/base/gtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: LinuxUtilTest -> MenuLabelAcceleratorTest Created 8 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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 "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/ui/gtk/gtk_util.h" 12 #include "chrome/browser/ui/gtk/gtk_util.h"
13 #include "content/public/browser/render_widget_host_view.h" 13 #include "content/public/browser/render_widget_host_view.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/context_menu_params.h" 15 #include "content/public/common/context_menu_params.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 #include "ui/base/gtk/menu_label_accelerator_util.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/gfx/linux_util.h"
19 19
20 using content::WebContents; 20 using content::WebContents;
21 21
22 namespace { 22 namespace {
23 23
24 // A callback function for gtk_container_foreach(). This callback just checks 24 // A callback function for gtk_container_foreach(). This callback just checks
25 // the menu ID and set the given user data if it is same as the specified ID. 25 // the menu ID and set the given user data if it is same as the specified ID.
26 struct GtkWidgetAtParam { 26 struct GtkWidgetAtParam {
27 int index; 27 int index;
28 GtkWidget* widget; 28 GtkWidget* widget;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if (rwhv) { 94 if (rwhv) {
95 MenuGtk* menu = menu_gtk_.get(); 95 MenuGtk* menu = menu_gtk_.get();
96 gboolean show_input_method_menu = TRUE; 96 gboolean show_input_method_menu = TRUE;
97 97
98 g_object_get( 98 g_object_get(
99 gtk_widget_get_settings(GTK_WIDGET(rwhv->GetNativeView())), 99 gtk_widget_get_settings(GTK_WIDGET(rwhv->GetNativeView())),
100 "gtk-show-input-method-menu", &show_input_method_menu, NULL); 100 "gtk-show-input-method-menu", &show_input_method_menu, NULL);
101 if (!show_input_method_menu) 101 if (!show_input_method_menu)
102 return; 102 return;
103 103
104 std::string label = gfx::ConvertAcceleratorsFromWindowsStyle( 104 std::string label = ui::ConvertAcceleratorsFromWindowsStyle(
105 l10n_util::GetStringUTF8(IDS_CONTENT_CONTEXT_INPUT_METHODS_MENU)); 105 l10n_util::GetStringUTF8(IDS_CONTENT_CONTEXT_INPUT_METHODS_MENU));
106 GtkWidget* menuitem = gtk_menu_item_new_with_mnemonic(label.c_str()); 106 GtkWidget* menuitem = gtk_menu_item_new_with_mnemonic(label.c_str());
107 GtkWidget* submenu = rwhv->BuildInputMethodsGtkMenu(); 107 GtkWidget* submenu = rwhv->BuildInputMethodsGtkMenu();
108 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); 108 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
109 menu->AppendSeparator(); 109 menu->AppendSeparator();
110 menu->AppendMenuItem(IDC_INPUT_METHODS_MENU, menuitem); 110 menu->AppendMenuItem(IDC_INPUT_METHODS_MENU, menuitem);
111 } 111 }
112 } 112 }
113 } 113 }
114 114
(...skipping 22 matching lines...) Expand all
137 return; 137 return;
138 138
139 // Enable (or disable) the menu item and updates its text. 139 // Enable (or disable) the menu item and updates its text.
140 gtk_widget_set_sensitive(item, enabled); 140 gtk_widget_set_sensitive(item, enabled);
141 if (hidden) 141 if (hidden)
142 gtk_widget_hide(item); 142 gtk_widget_hide(item);
143 else 143 else
144 gtk_widget_show(item); 144 gtk_widget_show(item);
145 gtk_menu_item_set_label(GTK_MENU_ITEM(item), UTF16ToUTF8(title).c_str()); 145 gtk_menu_item_set_label(GTK_MENU_ITEM(item), UTF16ToUTF8(title).c_str());
146 } 146 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698