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/focus_manager.h" | 8 #include "ui/aura/focus_manager.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/views/controls/native/native_view_host.h" | 10 #include "ui/views/controls/native/native_view_host.h" |
| 11 #include "ui/views/view_constants_aura.h" |
11 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
12 | 13 |
13 namespace views { | 14 namespace views { |
14 | 15 |
15 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) | 16 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) |
16 : host_(host), | 17 : host_(host), |
17 installed_clip_(false) { | 18 installed_clip_(false) { |
18 } | 19 } |
19 | 20 |
20 NativeViewHostAura::~NativeViewHostAura() { | 21 NativeViewHostAura::~NativeViewHostAura() { |
21 if (host_->native_view()) | 22 if (host_->native_view()) { |
| 23 host_->native_view()->ClearProperty(views::kHostViewKey); |
22 host_->native_view()->RemoveObserver(this); | 24 host_->native_view()->RemoveObserver(this); |
| 25 } |
23 } | 26 } |
24 | 27 |
25 //////////////////////////////////////////////////////////////////////////////// | 28 //////////////////////////////////////////////////////////////////////////////// |
26 // NativeViewHostAura, NativeViewHostWrapper implementation: | 29 // NativeViewHostAura, NativeViewHostWrapper implementation: |
27 void NativeViewHostAura::NativeViewWillAttach() { | 30 void NativeViewHostAura::NativeViewWillAttach() { |
28 host_->native_view()->AddObserver(this); | 31 host_->native_view()->AddObserver(this); |
| 32 host_->native_view()->SetProperty(views::kHostViewKey, |
| 33 static_cast<View*>(host_)); |
29 } | 34 } |
30 | 35 |
31 void NativeViewHostAura::NativeViewDetaching(bool destroyed) { | 36 void NativeViewHostAura::NativeViewDetaching(bool destroyed) { |
32 if (!destroyed) { | 37 if (!destroyed) { |
| 38 host_->native_view()->ClearProperty(views::kHostViewKey); |
33 host_->native_view()->RemoveObserver(this); | 39 host_->native_view()->RemoveObserver(this); |
34 host_->native_view()->Hide(); | 40 host_->native_view()->Hide(); |
35 if (host_->native_view()->parent()) | 41 if (host_->native_view()->parent()) |
36 Widget::ReparentNativeView(host_->native_view(), NULL); | 42 Widget::ReparentNativeView(host_->native_view(), NULL); |
37 } | 43 } |
38 } | 44 } |
39 | 45 |
40 void NativeViewHostAura::AddedToWidget() { | 46 void NativeViewHostAura::AddedToWidget() { |
41 if (!host_->native_view()) | 47 if (!host_->native_view()) |
42 return; | 48 return; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 host_->NativeViewDestroyed(); | 103 host_->NativeViewDestroyed(); |
98 } | 104 } |
99 | 105 |
100 // static | 106 // static |
101 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( | 107 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( |
102 NativeViewHost* host) { | 108 NativeViewHost* host) { |
103 return new NativeViewHostAura(host); | 109 return new NativeViewHostAura(host); |
104 } | 110 } |
105 | 111 |
106 } // namespace views | 112 } // namespace views |
OLD | NEW |