| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 9 #include "ui/base/event.h" | 9 #include "ui/base/events/event.h" |
| 10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
| 11 | 11 |
| 12 using content::NativeWebKeyboardEvent; | 12 using content::NativeWebKeyboardEvent; |
| 13 using content::WebContents; | 13 using content::WebContents; |
| 14 | 14 |
| 15 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent( | 15 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent( |
| 16 const WebContents* contents, | 16 const WebContents* contents, |
| 17 const ui::KeyEvent& key_event) { | 17 const ui::KeyEvent& key_event) { |
| 18 // NativeWebKeyboardEvent should take a const gfx::NativeEvent, which would | 18 // NativeWebKeyboardEvent should take a const gfx::NativeEvent, which would |
| 19 // prevent this casting. | 19 // prevent this casting. |
| 20 ui::Event* ui_event = | 20 ui::Event* ui_event = |
| 21 static_cast<ui::Event*>(const_cast<ui::KeyEvent*>(&key_event)); | 21 static_cast<ui::Event*>(const_cast<ui::KeyEvent*>(&key_event)); |
| 22 return NativeWebKeyboardEvent(ui_event); | 22 return NativeWebKeyboardEvent(ui_event); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos, | 25 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos, |
| 26 bool no_redraw) { | 26 bool no_redraw) { |
| 27 if (!host_->IsVisible()) | 27 if (!host_->IsVisible()) |
| 28 host_->GetNativeView()->Show(); | 28 host_->GetNativeView()->Show(); |
| 29 host_->GetNativeView()->SetBounds(new_pos); | 29 host_->GetNativeView()->SetBounds(new_pos); |
| 30 host_->StackAtTop(); | 30 host_->StackAtTop(); |
| 31 } | 31 } |
| OLD | NEW |