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/native/native_view_host_aura.h" | 5 #include "ui/views/controls/native/native_view_host_aura.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
9 #include "ui/aura/client/focus_client.h" | 9 #include "ui/aura/client/focus_client.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} | 57 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} |
58 | 58 |
59 private: | 59 private: |
60 aura::Window* native_view_; | 60 aura::Window* native_view_; |
61 }; | 61 }; |
62 | 62 |
63 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) | 63 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) |
64 : host_(host), | 64 : host_(host), |
65 clipping_window_delegate_(new ClippingWindowDelegate()), | 65 clipping_window_delegate_(new ClippingWindowDelegate()), |
66 clipping_window_(clipping_window_delegate_.get()) { | 66 clipping_window_(clipping_window_delegate_.get()) { |
| 67 // Set the type so descendant views (including popups) get positioned |
| 68 // appropriately. |
| 69 clipping_window_.SetType(ui::wm::WINDOW_TYPE_CONTROL); |
67 clipping_window_.Init(aura::WINDOW_LAYER_NOT_DRAWN); | 70 clipping_window_.Init(aura::WINDOW_LAYER_NOT_DRAWN); |
68 clipping_window_.set_owned_by_parent(false); | 71 clipping_window_.set_owned_by_parent(false); |
69 clipping_window_.SetName("NativeViewHostAuraClip"); | 72 clipping_window_.SetName("NativeViewHostAuraClip"); |
70 clipping_window_.layer()->SetMasksToBounds(true); | 73 clipping_window_.layer()->SetMasksToBounds(true); |
71 clipping_window_.SetProperty(views::kHostViewKey, static_cast<View*>(host_)); | 74 clipping_window_.SetProperty(views::kHostViewKey, static_cast<View*>(host_)); |
72 } | 75 } |
73 | 76 |
74 NativeViewHostAura::~NativeViewHostAura() { | 77 NativeViewHostAura::~NativeViewHostAura() { |
75 if (host_->native_view()) { | 78 if (host_->native_view()) { |
76 host_->native_view()->RemoveObserver(this); | 79 host_->native_view()->RemoveObserver(this); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } else { | 229 } else { |
227 clipping_window_.RemoveChild(host_->native_view()); | 230 clipping_window_.RemoveChild(host_->native_view()); |
228 } | 231 } |
229 host_->native_view()->SetBounds(clipping_window_.bounds()); | 232 host_->native_view()->SetBounds(clipping_window_.bounds()); |
230 } | 233 } |
231 if (clipping_window_.parent()) | 234 if (clipping_window_.parent()) |
232 clipping_window_.parent()->RemoveChild(&clipping_window_); | 235 clipping_window_.parent()->RemoveChild(&clipping_window_); |
233 } | 236 } |
234 | 237 |
235 } // namespace views | 238 } // namespace views |
OLD | NEW |