| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 void NativeViewHostAura::AddedToWidget() { | 41 void NativeViewHostAura::AddedToWidget() { |
| 42 if (!host_->native_view()) | 42 if (!host_->native_view()) |
| 43 return; | 43 return; |
| 44 | 44 |
| 45 aura::Window* widget_window = host_->GetWidget()->GetNativeView(); | 45 aura::Window* widget_window = host_->GetWidget()->GetNativeView(); |
| 46 if (host_->native_view()->parent() != widget_window) | 46 if (host_->native_view()->parent() != widget_window) |
| 47 widget_window->AddChild(host_->native_view()); | 47 widget_window->AddChild(host_->native_view()); |
| 48 if (host_->IsVisibleInRootView()) | 48 if (host_->IsDrawn()) |
| 49 host_->native_view()->Show(); | 49 host_->native_view()->Show(); |
| 50 else | 50 else |
| 51 host_->native_view()->Hide(); | 51 host_->native_view()->Hide(); |
| 52 host_->Layout(); | 52 host_->Layout(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void NativeViewHostAura::RemovedFromWidget() { | 55 void NativeViewHostAura::RemovedFromWidget() { |
| 56 if (host_->native_view() && host_->native_view()->parent()) | 56 if (host_->native_view() && host_->native_view()->parent()) |
| 57 host_->native_view()->parent()->RemoveChild(host_->native_view()); | 57 host_->native_view()->parent()->RemoveChild(host_->native_view()); |
| 58 } | 58 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 host_->NativeViewDestroyed(); | 94 host_->NativeViewDestroyed(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // static | 97 // static |
| 98 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( | 98 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( |
| 99 NativeViewHost* host) { | 99 NativeViewHost* host) { |
| 100 return new NativeViewHostAura(host); | 100 return new NativeViewHostAura(host); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace views | 103 } // namespace views |
| OLD | NEW |