Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/ui/views/dropdown_bar_host_aura.cc

Issue 15114002: Reorder the NativeViews attached to a view via kViewHostKey according to the position of the view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/ui/views/frame/browser_view.h"
9 #include "ui/aura/client/aura_constants.h"
8 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
9 #include "ui/base/events/event.h" 11 #include "ui/base/events/event.h"
12 #include "ui/views/view.h"
10 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
11 14
12 using content::NativeWebKeyboardEvent; 15 using content::NativeWebKeyboardEvent;
13 using content::WebContents; 16 using content::WebContents;
14 17
15 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent( 18 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent(
16 const WebContents* contents, 19 const WebContents* contents,
17 const ui::KeyEvent& key_event) { 20 const ui::KeyEvent& key_event) {
18 // NativeWebKeyboardEvent should take a const gfx::NativeEvent, which would 21 // NativeWebKeyboardEvent should take a const gfx::NativeEvent, which would
19 // prevent this casting. 22 // prevent this casting.
20 ui::Event* ui_event = 23 ui::Event* ui_event =
21 static_cast<ui::Event*>(const_cast<ui::KeyEvent*>(&key_event)); 24 static_cast<ui::Event*>(const_cast<ui::KeyEvent*>(&key_event));
22 return NativeWebKeyboardEvent(ui_event); 25 return NativeWebKeyboardEvent(ui_event);
23 } 26 }
24 27
25 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos, 28 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos,
26 bool no_redraw) { 29 bool no_redraw) {
27 if (!host_->IsVisible()) 30 if (!host_->IsVisible())
28 host_->GetNativeView()->Show(); 31 host_->GetNativeView()->Show();
29 host_->GetNativeView()->SetBounds(new_pos); 32 host_->GetNativeView()->SetBounds(new_pos);
33
34 if (!host_view_.get()) {
sky 2013/05/13 15:53:14 Could we instead always create a View for this in
pkotwicz 2013/05/13 20:20:44 I think that creating the view here makes more sen
35 // Create view to denote the z-order of |host_| relative to child views of
36 // |browser_view_| which have layers and NativeViews attached to a child
37 // NativeViewHost of |browser_view_|.
38 host_view_.reset(new views::View());
39 host_view_->set_owned_by_client();
40 browser_view_->AddChildView(host_view_.get());
41
42 // Set the mapping between the view and the NativeView. The property does
43 // not need to be cleared because |host_view_| and |host_| are both
44 // destroyed when DropdownBarHost is destroyed.
45 host_->GetNativeView()->SetProperty(aura::client::kHostViewKey,
46 host_view_.get());
47 }
48 browser_view_->ReorderChildView(host_view_.get(), -1);
49
50 // TODO(pkotwicz): Complete implementing denoting the z-order via
51 // aura::client::kHostViewKey and remove once the implementation is done.
30 host_->StackAtTop(); 52 host_->StackAtTop();
31 } 53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698