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 "chrome/browser/ui/gtk/web_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/web_dialog_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/property_bag.h" | 9 #include "base/property_bag.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 bool WebDialogGtk::ShouldShowDialogTitle() const { | 183 bool WebDialogGtk::ShouldShowDialogTitle() const { |
184 return true; | 184 return true; |
185 } | 185 } |
186 | 186 |
187 //////////////////////////////////////////////////////////////////////////////// | 187 //////////////////////////////////////////////////////////////////////////////// |
188 // content::WebContentsDelegate implementation: | 188 // content::WebContentsDelegate implementation: |
189 | 189 |
190 // A simplified version of BrowserWindowGtk::HandleKeyboardEvent(). | 190 // A simplified version of BrowserWindowGtk::HandleKeyboardEvent(). |
191 // We don't handle global keyboard shortcuts here, but that's fine since | 191 // We don't handle global keyboard shortcuts here, but that's fine since |
192 // they're all browser-specific. (This may change in the future.) | 192 // they're all browser-specific. (This may change in the future.) |
193 void WebDialogGtk::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 193 void WebDialogGtk::HandleKeyboardEvent(content::WebContents* source, |
| 194 const NativeWebKeyboardEvent& event) { |
194 GdkEventKey* os_event = &event.os_event->key; | 195 GdkEventKey* os_event = &event.os_event->key; |
195 if (!os_event || event.type == WebKit::WebInputEvent::Char) | 196 if (!os_event || event.type == WebKit::WebInputEvent::Char) |
196 return; | 197 return; |
197 | 198 |
198 // To make sure the default key bindings can still work, such as Escape to | 199 // To make sure the default key bindings can still work, such as Escape to |
199 // close the dialog. | 200 // close the dialog. |
200 gtk_bindings_activate_event(GTK_OBJECT(dialog_), os_event); | 201 gtk_bindings_activate_event(GTK_OBJECT(dialog_), os_event); |
201 } | 202 } |
202 | 203 |
203 //////////////////////////////////////////////////////////////////////////////// | 204 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 256 } |
256 | 257 |
257 gtk_widget_show_all(dialog_); | 258 gtk_widget_show_all(dialog_); |
258 | 259 |
259 return GTK_WINDOW(dialog_); | 260 return GTK_WINDOW(dialog_); |
260 } | 261 } |
261 | 262 |
262 void WebDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { | 263 void WebDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { |
263 OnDialogClosed(std::string()); | 264 OnDialogClosed(std::string()); |
264 } | 265 } |
OLD | NEW |