OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/html_dialog_view.h" | 5 #include "chrome/browser/ui/views/html_dialog_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 | 205 |
206 // A simplified version of BrowserView::HandleKeyboardEvent(). | 206 // A simplified version of BrowserView::HandleKeyboardEvent(). |
207 // We don't handle global keyboard shortcuts here, but that's fine since | 207 // We don't handle global keyboard shortcuts here, but that's fine since |
208 // they're all browser-specific. (This may change in the future.) | 208 // they're all browser-specific. (This may change in the future.) |
209 void HtmlDialogView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 209 void HtmlDialogView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
210 #if defined(OS_WIN) | 210 #if defined(OS_WIN) |
211 // Any unhandled keyboard/character messages should be defproced. | 211 // Any unhandled keyboard/character messages should be defproced. |
212 // This allows stuff like F10, etc to work correctly. | 212 // This allows stuff like F10, etc to work correctly. |
213 DefWindowProc(event.os_event.hwnd, event.os_event.message, | 213 DefWindowProc(event.os_event.hwnd, event.os_event.message, |
214 event.os_event.wParam, event.os_event.lParam); | 214 event.os_event.wParam, event.os_event.lParam); |
215 #elif defined(TOOLKIT_USES_GTK) | 215 #elif defined(TOOLKIT_USES_GTK) && !defined(USE_AURA) |
Ben Goodger (Google)
2011/09/16 01:11:18
In these circumstances I prefer the following flow
Emmanuel Saint-loubert-Bié
2011/09/16 02:34:54
Yes much cleaner!
| |
216 // TODO(saintlou): provide some Aura handling. | |
216 views::NativeWidgetGtk* window_gtk = | 217 views::NativeWidgetGtk* window_gtk = |
217 static_cast<views::NativeWidgetGtk*>(GetWidget()->native_widget()); | 218 static_cast<views::NativeWidgetGtk*>(GetWidget()->native_widget()); |
218 if (event.os_event && !event.skip_in_browser) { | 219 if (event.os_event && !event.skip_in_browser) { |
219 views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event)); | 220 views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event)); |
220 window_gtk->HandleKeyboardEvent(views_event); | 221 window_gtk->HandleKeyboardEvent(views_event); |
221 } | 222 } |
222 #endif | 223 #endif |
223 } | 224 } |
224 | 225 |
225 void HtmlDialogView::CloseContents(TabContents* source) { | 226 void HtmlDialogView::CloseContents(TabContents* source) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 break; | 282 break; |
282 default: | 283 default: |
283 NOTREACHED() << "unknown type" << type; | 284 NOTREACHED() << "unknown type" << type; |
284 } | 285 } |
285 } | 286 } |
286 | 287 |
287 void HtmlDialogView::RegisterDialogAccelerators() { | 288 void HtmlDialogView::RegisterDialogAccelerators() { |
288 // Pressing the ESC key will close the dialog. | 289 // Pressing the ESC key will close the dialog. |
289 AddAccelerator(views::Accelerator(ui::VKEY_ESCAPE, false, false, false)); | 290 AddAccelerator(views::Accelerator(ui::VKEY_ESCAPE, false, false, false)); |
290 } | 291 } |
OLD | NEW |