| 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/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
| 9 #include "ui/aura/client/focus_client.h" | 9 #include "ui/aura/client/focus_client.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/base/cursor/cursor.h" | 11 #include "ui/base/cursor/cursor.h" |
| 12 #include "ui/views/controls/native/native_view_host.h" | 12 #include "ui/views/controls/native/native_view_host.h" |
| 13 #include "ui/views/view_constants_aura.h" | 13 #include "ui/views/view_constants_aura.h" |
| 14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 | 17 |
| 18 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) | 18 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) |
| 19 : host_(host), | 19 : host_(host), |
| 20 clipping_window_(NULL) { | 20 clipping_window_(NULL) { |
| 21 clipping_window_.Init(aura::WINDOW_LAYER_NOT_DRAWN); | 21 clipping_window_.Init(aura::WINDOW_LAYER_NOT_DRAWN); |
| 22 clipping_window_.SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 22 clipping_window_.set_owned_by_parent(false); | 23 clipping_window_.set_owned_by_parent(false); |
| 23 clipping_window_.SetName("NativeViewHostAuraClip"); | 24 clipping_window_.SetName("NativeViewHostAuraClip"); |
| 24 clipping_window_.layer()->SetMasksToBounds(true); | 25 clipping_window_.layer()->SetMasksToBounds(true); |
| 25 clipping_window_.SetProperty(views::kHostViewKey, static_cast<View*>(host_)); | 26 clipping_window_.SetProperty(views::kHostViewKey, static_cast<View*>(host_)); |
| 26 } | 27 } |
| 27 | 28 |
| 28 NativeViewHostAura::~NativeViewHostAura() { | 29 NativeViewHostAura::~NativeViewHostAura() { |
| 29 if (host_->native_view()) { | 30 if (host_->native_view()) { |
| 30 host_->native_view()->RemoveObserver(this); | 31 host_->native_view()->RemoveObserver(this); |
| 31 host_->native_view()->ClearProperty(views::kHostViewKey); | 32 host_->native_view()->ClearProperty(views::kHostViewKey); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } else { | 174 } else { |
| 174 clipping_window_.RemoveChild(host_->native_view()); | 175 clipping_window_.RemoveChild(host_->native_view()); |
| 175 } | 176 } |
| 176 host_->native_view()->SetBounds(clipping_window_.bounds()); | 177 host_->native_view()->SetBounds(clipping_window_.bounds()); |
| 177 } | 178 } |
| 178 if (clipping_window_.parent()) | 179 if (clipping_window_.parent()) |
| 179 clipping_window_.parent()->RemoveChild(&clipping_window_); | 180 clipping_window_.parent()->RemoveChild(&clipping_window_); |
| 180 } | 181 } |
| 181 | 182 |
| 182 } // namespace views | 183 } // namespace views |
| OLD | NEW |