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/views/dropdown_bar_host.h" | 5 #include "chrome/browser/ui/views/dropdown_bar_host.h" |
6 | 6 |
7 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 7 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
8 #include "chrome/browser/ui/views/frame/browser_view.h" | 8 #include "chrome/browser/ui/views/frame/browser_view.h" |
9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "content/public/browser/web_contents_view.h" | 11 #include "content/public/browser/web_contents_view.h" |
| 12 #include "ui/base/event.h" |
12 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 13 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
13 #include "ui/views/controls/scrollbar/native_scroll_bar.h" | 14 #include "ui/views/controls/scrollbar/native_scroll_bar.h" |
14 | 15 |
15 using content::NativeWebKeyboardEvent; | 16 using content::NativeWebKeyboardEvent; |
16 using content::WebContents; | 17 using content::WebContents; |
17 | 18 |
18 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent( | 19 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent( |
19 const WebContents* contents, | 20 const WebContents* contents, |
20 const views::KeyEvent& key_event) { | 21 const ui::KeyEvent& key_event) { |
21 HWND hwnd = contents->GetContentNativeView(); | 22 HWND hwnd = contents->GetContentNativeView(); |
22 WORD key = WindowsKeyCodeForKeyboardCode(key_event.key_code()); | 23 WORD key = WindowsKeyCodeForKeyboardCode(key_event.key_code()); |
23 | 24 |
24 MSG msg = { hwnd, key_event.native_event().message, key, 0 }; | 25 MSG msg = { hwnd, key_event.native_event().message, key, 0 }; |
25 return NativeWebKeyboardEvent(msg); | 26 return NativeWebKeyboardEvent(msg); |
26 } | 27 } |
27 | 28 |
28 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos, | 29 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos, |
29 bool no_redraw) { | 30 bool no_redraw) { |
30 DWORD swp_flags = SWP_NOOWNERZORDER; | 31 DWORD swp_flags = SWP_NOOWNERZORDER; |
31 if (no_redraw) | 32 if (no_redraw) |
32 swp_flags |= SWP_NOREDRAW; | 33 swp_flags |= SWP_NOREDRAW; |
33 if (!host_->IsVisible()) | 34 if (!host_->IsVisible()) |
34 swp_flags |= SWP_SHOWWINDOW; | 35 swp_flags |= SWP_SHOWWINDOW; |
35 | 36 |
36 ::SetWindowPos(host_->GetNativeView(), HWND_TOP, new_pos.x(), new_pos.y(), | 37 ::SetWindowPos(host_->GetNativeView(), HWND_TOP, new_pos.x(), new_pos.y(), |
37 new_pos.width(), new_pos.height(), swp_flags); | 38 new_pos.width(), new_pos.height(), swp_flags); |
38 } | 39 } |
OLD | NEW |