| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/gtk/browser_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 void BrowserWindowGtk::ShowAppMenu() { | 1088 void BrowserWindowGtk::ShowAppMenu() { |
| 1089 toolbar_->ShowAppMenu(); | 1089 toolbar_->ShowAppMenu(); |
| 1090 } | 1090 } |
| 1091 | 1091 |
| 1092 bool BrowserWindowGtk::PreHandleKeyboardEvent( | 1092 bool BrowserWindowGtk::PreHandleKeyboardEvent( |
| 1093 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { | 1093 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { |
| 1094 GdkEventKey* os_event = &event.os_event->key; | 1094 GdkEventKey* os_event = &event.os_event->key; |
| 1095 | 1095 |
| 1096 if (!os_event || event.type != WebKit::WebInputEvent::RawKeyDown) | 1096 if (!os_event || event.type != blink::WebInputEvent::RawKeyDown) |
| 1097 return false; | 1097 return false; |
| 1098 | 1098 |
| 1099 if (ExtensionKeybindingRegistryGtk::shortcut_handling_suspended()) | 1099 if (ExtensionKeybindingRegistryGtk::shortcut_handling_suspended()) |
| 1100 return false; | 1100 return false; |
| 1101 | 1101 |
| 1102 // We first find out the browser command associated to the |event|. | 1102 // We first find out the browser command associated to the |event|. |
| 1103 // Then if the command is a reserved one, and should be processed immediately | 1103 // Then if the command is a reserved one, and should be processed immediately |
| 1104 // according to the |event|, the command will be executed immediately. | 1104 // according to the |event|, the command will be executed immediately. |
| 1105 // Otherwise we just set |*is_keyboard_shortcut| properly and return false. | 1105 // Otherwise we just set |*is_keyboard_shortcut| properly and return false. |
| 1106 | 1106 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 DCHECK(is_keyboard_shortcut != NULL); | 1154 DCHECK(is_keyboard_shortcut != NULL); |
| 1155 *is_keyboard_shortcut = true; | 1155 *is_keyboard_shortcut = true; |
| 1156 | 1156 |
| 1157 return false; | 1157 return false; |
| 1158 } | 1158 } |
| 1159 | 1159 |
| 1160 void BrowserWindowGtk::HandleKeyboardEvent( | 1160 void BrowserWindowGtk::HandleKeyboardEvent( |
| 1161 const NativeWebKeyboardEvent& event) { | 1161 const NativeWebKeyboardEvent& event) { |
| 1162 GdkEventKey* os_event = &event.os_event->key; | 1162 GdkEventKey* os_event = &event.os_event->key; |
| 1163 | 1163 |
| 1164 if (!os_event || event.type != WebKit::WebInputEvent::RawKeyDown) | 1164 if (!os_event || event.type != blink::WebInputEvent::RawKeyDown) |
| 1165 return; | 1165 return; |
| 1166 | 1166 |
| 1167 // Handles a key event in following sequence: | 1167 // Handles a key event in following sequence: |
| 1168 // 1. Our special key accelerators, such as ctrl-tab, etc. | 1168 // 1. Our special key accelerators, such as ctrl-tab, etc. |
| 1169 // 2. Gtk accelerators. | 1169 // 2. Gtk accelerators. |
| 1170 // This sequence matches the default key press handler of GtkWindow. | 1170 // This sequence matches the default key press handler of GtkWindow. |
| 1171 // | 1171 // |
| 1172 // It's not necessary to care about the keyboard layout, as | 1172 // It's not necessary to care about the keyboard layout, as |
| 1173 // gtk_window_activate_key() takes care of it automatically. | 1173 // gtk_window_activate_key() takes care of it automatically. |
| 1174 int id = GetCustomCommandId(os_event); | 1174 int id = GetCustomCommandId(os_event); |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 wm_type == ui::WM_OPENBOX || | 2411 wm_type == ui::WM_OPENBOX || |
| 2412 wm_type == ui::WM_XFWM4); | 2412 wm_type == ui::WM_XFWM4); |
| 2413 } | 2413 } |
| 2414 | 2414 |
| 2415 // static | 2415 // static |
| 2416 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2416 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2417 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2417 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
| 2418 browser_window_gtk->Init(); | 2418 browser_window_gtk->Init(); |
| 2419 return browser_window_gtk; | 2419 return browser_window_gtk; |
| 2420 } | 2420 } |
| OLD | NEW |