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

Unified Diff: content/shell/shell_gtk.cc

Issue 10855070: Add shortcut to create new window for GTK content shell. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix nits 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
« no previous file with comments | « content/shell/shell.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/shell_gtk.cc
diff --git a/content/shell/shell_gtk.cc b/content/shell/shell_gtk.cc
index 7cb795129484774b2c9fb3057c7a6bba237462ab..0f9121bdf547bca3bfaa19d03cd46b2aa9186000 100644
--- a/content/shell/shell_gtk.cc
+++ b/content/shell/shell_gtk.cc
@@ -16,6 +16,8 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/renderer_preferences.h"
+#include "content/shell/shell_browser_context.h"
+#include "content/shell/shell_content_browser_client.h"
#include "content/shell/shell_switches.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -82,6 +84,12 @@ void Shell::PlatformCreateWindow(int width, int height) {
g_cclosure_new(G_CALLBACK(OnCloseWindowKeyPressedThunk),
this, NULL));
+ gtk_accel_group_connect(
+ accel_group, GDK_n, GDK_CONTROL_MASK,
+ GTK_ACCEL_VISIBLE,
+ g_cclosure_new(G_CALLBACK(OnNewWindowKeyPressedThunk),
+ this, NULL));
+
GtkWidget* toolbar = gtk_toolbar_new();
// Turn off the labels on the toolbar buttons.
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
@@ -224,6 +232,21 @@ gboolean Shell::OnCloseWindowKeyPressed(GtkAccelGroup* accel_group,
return TRUE;
}
+gboolean Shell::OnNewWindowKeyPressed(GtkAccelGroup* accel_group,
+ GObject* acceleratable,
+ guint keyval,
+ GdkModifierType modifier) {
+ ShellBrowserContext* browser_context =
+ static_cast<ShellContentBrowserClient*>(
+ GetContentClient()->browser())->browser_context();
+ Shell::CreateNewWindow(browser_context,
+ GURL(),
+ NULL,
+ MSG_ROUTING_NONE,
+ NULL);
+ return TRUE;
+}
+
gboolean Shell::OnHighlightURLView(GtkAccelGroup* accel_group,
GObject* acceleratable,
guint keyval,
« no previous file with comments | « content/shell/shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698