Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / dropdown_bar_host_aura.cc
blob3cd73d285534642d2a76f39a5229aa1581f5c778
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/dropdown_bar_host.h"
7 #include "base/logging.h"
8 #include "ui/aura/window.h"
9 #include "ui/events/event.h"
10 #include "ui/views/view_constants_aura.h"
11 #include "ui/views/widget/widget.h"
13 using content::NativeWebKeyboardEvent;
14 using content::WebContents;
16 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent(
17 const WebContents* contents,
18 const ui::KeyEvent& key_event) {
19 // NativeWebKeyboardEvent should take a const gfx::NativeEvent, which would
20 // prevent this casting.
21 ui::Event* ui_event =
22 static_cast<ui::Event*>(const_cast<ui::KeyEvent*>(&key_event));
23 return NativeWebKeyboardEvent(ui_event);
26 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos,
27 bool no_redraw) {
28 if (!host_->IsVisible())
29 host_->GetNativeView()->Show();
30 host_->GetNativeView()->SetBounds(new_pos);
32 // The z-order of |host_| is controlled by the view specified via
33 // views::kHostViewKey.
36 void DropdownBarHost::SetHostViewNative(views::View* host_view) {
37 host_->GetNativeView()->SetProperty(views::kHostViewKey, host_view);