| 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_win.h" | 5 #include "ui/views/controls/native/native_view_host_win.h" |
| 6 | 6 |
| 7 #include <oleacc.h> | 7 #include <oleacc.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/base/win/hidden_window.h" | 10 #include "ui/base/win/hidden_window.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 NativeViewHostWin::NativeViewHostWin(NativeViewHost* host) | 25 NativeViewHostWin::NativeViewHostWin(NativeViewHost* host) |
| 26 : host_(host), | 26 : host_(host), |
| 27 installed_clip_(false) { | 27 installed_clip_(false) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 NativeViewHostWin::~NativeViewHostWin() { | 30 NativeViewHostWin::~NativeViewHostWin() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
| 34 // NativeViewHostWin, NativeViewHostWrapper implementation: | 34 // NativeViewHostWin, NativeViewHostWrapper implementation: |
| 35 void NativeViewHostWin::NativeViewWillAttach() { | 35 void NativeViewHostWin::AttachNativeView() { |
| 36 // First hide the new window. We don't want anything to draw (like sub-hwnd | 36 // First hide the new window. We don't want anything to draw (like sub-hwnd |
| 37 // borders), when NativeViewHost changes the parent. | 37 // borders), when the parent changes. |
| 38 ShowWindow(host_->native_view(), SW_HIDE); | 38 ShowWindow(host_->native_view(), SW_HIDE); |
| 39 |
| 40 Widget::ReparentNativeView(host_->native_view(), |
| 41 host_->GetWidget()->GetNativeView()); |
| 42 host_->Layout(); |
| 43 |
| 44 Widget* widget = Widget::GetWidgetForNativeView(host_->native_view()); |
| 45 if (widget) |
| 46 widget->SetNativeWindowProperty(kWidgetNativeViewHostKey, host(host()); |
| 39 } | 47 } |
| 40 | 48 |
| 41 void NativeViewHostWin::NativeViewDetaching(bool destroyed) { | 49 void NativeViewHostWin::NativeViewDetaching(bool destroyed) { |
| 42 if (!destroyed) { | 50 if (!destroyed) { |
| 43 if (installed_clip_) | 51 if (installed_clip_) |
| 44 UninstallClip(); | 52 UninstallClip(); |
| 45 Widget::ReparentNativeView(host_->native_view(), ui::GetHiddenWindow()); | 53 Widget::ReparentNativeView(host_->native_view(), ui::GetHiddenWindow()); |
| 46 } | 54 } |
| 47 installed_clip_ = false; | 55 installed_clip_ = false; |
| 48 } | 56 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 //////////////////////////////////////////////////////////////////////////////// | 156 //////////////////////////////////////////////////////////////////////////////// |
| 149 // NativeViewHostWrapper, public: | 157 // NativeViewHostWrapper, public: |
| 150 | 158 |
| 151 // static | 159 // static |
| 152 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( | 160 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( |
| 153 NativeViewHost* host) { | 161 NativeViewHost* host) { |
| 154 return new NativeViewHostWin(host); | 162 return new NativeViewHostWin(host); |
| 155 } | 163 } |
| 156 | 164 |
| 157 } // namespace views | 165 } // namespace views |
| OLD | NEW |