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

Unified Diff: content/shell/shell_gtk.cc

Issue 10837177: Add a menu item to content_shell to open devtools to make it more discoverable. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix android compile, and add gtk support Created 8 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/shell_gtk.cc
===================================================================
--- content/shell/shell_gtk.cc (revision 150609)
+++ content/shell/shell_gtk.cc (working copy)
@@ -21,6 +21,40 @@
namespace content {
+namespace {
+
+// Callback for Debug > Show web inspector... menu item.
+gboolean ShowWebInspectorActivated(GtkWidget* widget, Shell* shell) {
+ shell->ShowDevTools();
+ return FALSE; // Don't stop this message.
+}
+
+GtkWidget* AddMenuEntry(GtkWidget* menu_widget, const char* text,
+ GCallback callback, Shell* shell) {
+ GtkWidget* entry = gtk_menu_item_new_with_label(text);
+ g_signal_connect(entry, "activate", callback, shell);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_widget), entry);
+ return entry;
+}
+
+GtkWidget* CreateMenu(GtkWidget* menu_bar, const char* text) {
+ GtkWidget* menu_widget = gtk_menu_new();
+ GtkWidget* menu_header = gtk_menu_item_new_with_label(text);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_header), menu_widget);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), menu_header);
+ return menu_widget;
+}
+
+GtkWidget* CreateMenuBar(Shell* shell) {
+ GtkWidget* menu_bar = gtk_menu_bar_new();
+ GtkWidget* debug_menu = CreateMenu(menu_bar, "Debug");
+ AddMenuEntry(debug_menu, "Show web inspector...",
+ G_CALLBACK(ShowWebInspectorActivated), shell);
+ return menu_bar;
+}
+
+} // namespace
+
void Shell::PlatformInitialize() {
}
@@ -71,6 +105,10 @@
vbox_ = gtk_vbox_new(FALSE, 0);
+ // Create the menu bar.
+ GtkWidget* menu_bar = CreateMenuBar(this);
+ gtk_box_pack_start(GTK_BOX(vbox_), menu_bar, FALSE, FALSE, 0);
+
// Create the object that mediates accelerators.
GtkAccelGroup* accel_group = gtk_accel_group_new();
gtk_window_add_accel_group(GTK_WINDOW(window_), accel_group);

Powered by Google App Engine
This is Rietveld 408576698