OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/html_dialog_gtk.h" | 5 #include "chrome/browser/gtk/html_dialog_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void HtmlDialogGtk::MoveContents(TabContents* source, const gfx::Rect& pos) { | 95 void HtmlDialogGtk::MoveContents(TabContents* source, const gfx::Rect& pos) { |
96 // The contained web page wishes to resize itself. We let it do this because | 96 // The contained web page wishes to resize itself. We let it do this because |
97 // if it's a dialog we know about, we trust it not to be mean to the user. | 97 // if it's a dialog we know about, we trust it not to be mean to the user. |
98 } | 98 } |
99 | 99 |
100 void HtmlDialogGtk::ToolbarSizeChanged(TabContents* source, | 100 void HtmlDialogGtk::ToolbarSizeChanged(TabContents* source, |
101 bool is_animating) { | 101 bool is_animating) { |
102 // Ignored. | 102 // Ignored. |
103 } | 103 } |
104 | 104 |
| 105 // A simplified version of BrowserWindowGtk::HandleKeyboardEvent(). |
| 106 // We don't handle global keyboard shortcuts here, but that's fine since |
| 107 // they're all browser-specific. (This may change in the future.) |
| 108 void HtmlDialogGtk::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 109 GdkEventKey* os_event = event.os_event; |
| 110 if (!os_event || event.type == WebKit::WebInputEvent::Char) |
| 111 return; |
| 112 |
| 113 // To make sure the default key bindings can still work, such as Escape to |
| 114 // close the dialog. |
| 115 gtk_bindings_activate_event(GTK_OBJECT(dialog_), os_event); |
| 116 } |
| 117 |
105 //////////////////////////////////////////////////////////////////////////////// | 118 //////////////////////////////////////////////////////////////////////////////// |
106 // HtmlDialogGtk: | 119 // HtmlDialogGtk: |
107 | 120 |
108 void HtmlDialogGtk::InitDialog() { | 121 void HtmlDialogGtk::InitDialog() { |
109 tab_contents_.reset( | 122 tab_contents_.reset( |
110 new TabContents(profile(), NULL, MSG_ROUTING_NONE, NULL)); | 123 new TabContents(profile(), NULL, MSG_ROUTING_NONE, NULL)); |
111 tab_contents_->set_delegate(this); | 124 tab_contents_->set_delegate(this); |
112 | 125 |
113 // This must be done before loading the page; see the comments in | 126 // This must be done before loading the page; see the comments in |
114 // HtmlDialogUI. | 127 // HtmlDialogUI. |
(...skipping 28 matching lines...) Expand all Loading... |
143 dialog_size.height()); | 156 dialog_size.height()); |
144 | 157 |
145 gtk_widget_show_all(dialog_); | 158 gtk_widget_show_all(dialog_); |
146 } | 159 } |
147 | 160 |
148 // static | 161 // static |
149 void HtmlDialogGtk::OnResponse(GtkWidget* widget, int response, | 162 void HtmlDialogGtk::OnResponse(GtkWidget* widget, int response, |
150 HtmlDialogGtk* dialog) { | 163 HtmlDialogGtk* dialog) { |
151 dialog->OnDialogClosed(std::string()); | 164 dialog->OnDialogClosed(std::string()); |
152 } | 165 } |
OLD | NEW |