| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 void CreateHost() { | 103 void CreateHost() { |
| 104 // Create the top level widget. | 104 // Create the top level widget. |
| 105 toplevel_.reset(new Widget); | 105 toplevel_.reset(new Widget); |
| 106 Widget::InitParams toplevel_params = | 106 Widget::InitParams toplevel_params = |
| 107 CreateParams(Widget::InitParams::TYPE_WINDOW); | 107 CreateParams(Widget::InitParams::TYPE_WINDOW); |
| 108 toplevel_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 108 toplevel_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 109 toplevel_->Init(toplevel_params); | 109 toplevel_->Init(toplevel_params); |
| 110 | 110 |
| 111 // And the child widget. | 111 // And the child widget. |
| 112 View* test_view = new View; | |
| 113 child_.reset(new Widget); | 112 child_.reset(new Widget); |
| 114 Widget::InitParams child_params(Widget::InitParams::TYPE_CONTROL); | 113 Widget::InitParams child_params(Widget::InitParams::TYPE_CONTROL); |
| 115 child_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 114 child_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 116 child_params.parent = toplevel_->GetNativeView(); | 115 child_params.parent = toplevel_->GetNativeView(); |
| 117 child_->Init(child_params); | 116 child_->Init(child_params); |
| 118 child_->SetContentsView(test_view); | 117 child_->SetContentsView(new View); |
| 119 | 118 |
| 120 // Owned by |toplevel|. | 119 // Owned by |toplevel|. |
| 121 host_.reset(new NativeViewHostTesting); | 120 host_.reset(new NativeViewHostTesting); |
| 122 toplevel_->GetRootView()->AddChildView(host_.get()); | 121 toplevel_->GetRootView()->AddChildView(host_.get()); |
| 123 host_->Attach(child_->GetNativeView()); | 122 host_->Attach(child_->GetNativeView()); |
| 124 } | 123 } |
| 125 | 124 |
| 126 void DestroyHost() { | 125 void DestroyHost() { |
| 127 host_.reset(); | 126 host_.reset(); |
| 128 } | 127 } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 test_observer.events()[2].first); | 318 test_observer.events()[2].first); |
| 320 EXPECT_EQ(child()->GetNativeView(), test_observer.events()[2].second); | 319 EXPECT_EQ(child()->GetNativeView(), test_observer.events()[2].second); |
| 321 | 320 |
| 322 clipping_window()->RemoveObserver(&test_observer); | 321 clipping_window()->RemoveObserver(&test_observer); |
| 323 child()->GetNativeView()->RemoveObserver(&test_observer); | 322 child()->GetNativeView()->RemoveObserver(&test_observer); |
| 324 | 323 |
| 325 DestroyHost(); | 324 DestroyHost(); |
| 326 } | 325 } |
| 327 | 326 |
| 328 } // namespace views | 327 } // namespace views |
| OLD | NEW |