| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 host_->GetWidget()->GetNativeView()->AddChild(host_->native_view()); | 28 host_->GetWidget()->GetNativeView()->AddChild(host_->native_view()); |
| 29 host_->Layout(); | 29 host_->Layout(); |
| 30 | 30 |
| 31 host_->native_view()->AddObserver(this); | 31 host_->native_view()->AddObserver(this); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void NativeViewHostAura::NativeViewDetaching(bool destroyed) { | 34 void NativeViewHostAura::NativeViewDetaching(bool destroyed) { |
| 35 if (!destroyed) { | 35 if (!destroyed) { |
| 36 host_->native_view()->RemoveObserver(this); | 36 host_->native_view()->RemoveObserver(this); |
| 37 host_->native_view()->Hide(); | 37 host_->native_view()->Hide(); |
| 38 if (host_->native_view()->parent()) |
| 39 host_->native_view()->parent()->RemoveChild(host_->native_view()); |
| 38 } | 40 } |
| 39 } | 41 } |
| 40 | 42 |
| 41 void NativeViewHostAura::AddedToWidget() { | 43 void NativeViewHostAura::AddedToWidget() { |
| 42 if (!host_->native_view()) | 44 if (!host_->native_view()) |
| 43 return; | 45 return; |
| 44 | 46 |
| 45 aura::Window* widget_window = host_->GetWidget()->GetNativeView(); | 47 aura::Window* widget_window = host_->GetWidget()->GetNativeView(); |
| 46 if (host_->native_view()->parent() != widget_window) | 48 if (host_->native_view()->parent() != widget_window) |
| 47 widget_window->AddChild(host_->native_view()); | 49 widget_window->AddChild(host_->native_view()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 host_->NativeViewDestroyed(); | 99 host_->NativeViewDestroyed(); |
| 98 } | 100 } |
| 99 | 101 |
| 100 // static | 102 // static |
| 101 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( | 103 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( |
| 102 NativeViewHost* host) { | 104 NativeViewHost* host) { |
| 103 return new NativeViewHostAura(host); | 105 return new NativeViewHostAura(host); |
| 104 } | 106 } |
| 105 | 107 |
| 106 } // namespace views | 108 } // namespace views |
| OLD | NEW |