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 "ui/views/controls/webview/web_dialog_view.h" | 5 #include "ui/views/controls/webview/web_dialog_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 239 |
240 void WebDialogView::MoveContents(WebContents* source, const gfx::Rect& pos) { | 240 void WebDialogView::MoveContents(WebContents* source, const gfx::Rect& pos) { |
241 // The contained web page wishes to resize itself. We let it do this because | 241 // The contained web page wishes to resize itself. We let it do this because |
242 // if it's a dialog we know about, we trust it not to be mean to the user. | 242 // if it's a dialog we know about, we trust it not to be mean to the user. |
243 GetWidget()->SetBounds(pos); | 243 GetWidget()->SetBounds(pos); |
244 } | 244 } |
245 | 245 |
246 // A simplified version of BrowserView::HandleKeyboardEvent(). | 246 // A simplified version of BrowserView::HandleKeyboardEvent(). |
247 // We don't handle global keyboard shortcuts here, but that's fine since | 247 // We don't handle global keyboard shortcuts here, but that's fine since |
248 // they're all browser-specific. (This may change in the future.) | 248 // they're all browser-specific. (This may change in the future.) |
249 void WebDialogView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 249 void WebDialogView::HandleKeyboardEvent(content::WebContents* source, |
| 250 const NativeWebKeyboardEvent& event) { |
250 #if defined(USE_AURA) | 251 #if defined(USE_AURA) |
251 aura::KeyEvent aura_event(event.os_event->native_event(), false); | 252 aura::KeyEvent aura_event(event.os_event->native_event(), false); |
252 views::NativeWidgetAura* aura_widget = | 253 views::NativeWidgetAura* aura_widget = |
253 static_cast<views::NativeWidgetAura*>(GetWidget()->native_widget()); | 254 static_cast<views::NativeWidgetAura*>(GetWidget()->native_widget()); |
254 aura_widget->OnKeyEvent(&aura_event); | 255 aura_widget->OnKeyEvent(&aura_event); |
255 #elif defined(OS_WIN) | 256 #elif defined(OS_WIN) |
256 // Any unhandled keyboard/character messages should be defproced. | 257 // Any unhandled keyboard/character messages should be defproced. |
257 // This allows stuff like F10, etc to work correctly. | 258 // This allows stuff like F10, etc to work correctly. |
258 DefWindowProc(event.os_event.hwnd, event.os_event.message, | 259 DefWindowProc(event.os_event.hwnd, event.os_event.message, |
259 event.os_event.wParam, event.os_event.lParam); | 260 event.os_event.wParam, event.os_event.lParam); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 gfx::Size out; | 316 gfx::Size out; |
316 delegate_->GetDialogSize(&out); | 317 delegate_->GetDialogSize(&out); |
317 if (!out.IsEmpty() && GetWidget()) | 318 if (!out.IsEmpty() && GetWidget()) |
318 GetWidget()->CenterWindow(out); | 319 GetWidget()->CenterWindow(out); |
319 } | 320 } |
320 | 321 |
321 web_view_->LoadInitialURL(GetDialogContentURL()); | 322 web_view_->LoadInitialURL(GetDialogContentURL()); |
322 } | 323 } |
323 | 324 |
324 } // namespace views | 325 } // namespace views |
OLD | NEW |