OLD | NEW |
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 "content/shell/shell.h" | 5 #include "content/shell/shell.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 GTK_ACCEL_VISIBLE, | 127 GTK_ACCEL_VISIBLE, |
128 g_cclosure_new(G_CALLBACK(OnCloseWindowKeyPressedThunk), | 128 g_cclosure_new(G_CALLBACK(OnCloseWindowKeyPressedThunk), |
129 this, NULL)); | 129 this, NULL)); |
130 | 130 |
131 gtk_accel_group_connect( | 131 gtk_accel_group_connect( |
132 accel_group, GDK_n, GDK_CONTROL_MASK, | 132 accel_group, GDK_n, GDK_CONTROL_MASK, |
133 GTK_ACCEL_VISIBLE, | 133 GTK_ACCEL_VISIBLE, |
134 g_cclosure_new(G_CALLBACK(OnNewWindowKeyPressedThunk), | 134 g_cclosure_new(G_CALLBACK(OnNewWindowKeyPressedThunk), |
135 this, NULL)); | 135 this, NULL)); |
136 | 136 |
| 137 gtk_accel_group_connect( |
| 138 accel_group, GDK_F5, (GdkModifierType)0, |
| 139 GTK_ACCEL_VISIBLE, |
| 140 g_cclosure_new(G_CALLBACK(OnReloadKeyPressedThunk), |
| 141 this, NULL)); |
| 142 |
137 GtkWidget* toolbar = gtk_toolbar_new(); | 143 GtkWidget* toolbar = gtk_toolbar_new(); |
138 // Turn off the labels on the toolbar buttons. | 144 // Turn off the labels on the toolbar buttons. |
139 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); | 145 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); |
140 | 146 |
141 back_button_ = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK); | 147 back_button_ = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK); |
142 g_signal_connect(back_button_, "clicked", | 148 g_signal_connect(back_button_, "clicked", |
143 G_CALLBACK(&OnBackButtonClickedThunk), this); | 149 G_CALLBACK(&OnBackButtonClickedThunk), this); |
144 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), back_button_, -1 /* append */); | 150 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), back_button_, -1 /* append */); |
145 gtk_widget_add_accelerator(GTK_WIDGET(back_button_), "clicked", accel_group, | 151 gtk_widget_add_accelerator(GTK_WIDGET(back_button_), "clicked", accel_group, |
146 GDK_Left, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); | 152 GDK_Left, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 } | 287 } |
282 | 288 |
283 gboolean Shell::OnHighlightURLView(GtkAccelGroup* accel_group, | 289 gboolean Shell::OnHighlightURLView(GtkAccelGroup* accel_group, |
284 GObject* acceleratable, | 290 GObject* acceleratable, |
285 guint keyval, | 291 guint keyval, |
286 GdkModifierType modifier) { | 292 GdkModifierType modifier) { |
287 gtk_widget_grab_focus(GTK_WIDGET(url_edit_view_)); | 293 gtk_widget_grab_focus(GTK_WIDGET(url_edit_view_)); |
288 return TRUE; | 294 return TRUE; |
289 } | 295 } |
290 | 296 |
| 297 gboolean Shell::OnReloadKeyPressed(GtkAccelGroup* accel_group, |
| 298 GObject* acceleratable, |
| 299 guint keyval, |
| 300 GdkModifierType modifier) { |
| 301 Reload(); |
| 302 return TRUE; |
| 303 } |
| 304 |
291 void Shell::PlatformSetTitle(const string16& title) { | 305 void Shell::PlatformSetTitle(const string16& title) { |
292 if (headless_) | 306 if (headless_) |
293 return; | 307 return; |
294 | 308 |
295 std::string title_utf8 = UTF16ToUTF8(title); | 309 std::string title_utf8 = UTF16ToUTF8(title); |
296 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str()); | 310 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str()); |
297 } | 311 } |
298 | 312 |
299 } // namespace content | 313 } // namespace content |
OLD | NEW |