| 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" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 aura::Window* native_view_; | 63 aura::Window* native_view_; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) | 66 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) |
| 67 : host_(host), | 67 : host_(host), |
| 68 clipping_window_delegate_(new ClippingWindowDelegate()), | 68 clipping_window_delegate_(new ClippingWindowDelegate()), |
| 69 clipping_window_(clipping_window_delegate_.get()) { | 69 clipping_window_(clipping_window_delegate_.get()) { |
| 70 // Set the type so descendant views (including popups) get positioned | 70 // Set the type so descendant views (including popups) get positioned |
| 71 // appropriately. | 71 // appropriately. |
| 72 clipping_window_.SetType(ui::wm::WINDOW_TYPE_CONTROL); | 72 clipping_window_.SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 73 clipping_window_.Init(aura::WINDOW_LAYER_NOT_DRAWN); | 73 clipping_window_.Init(ui::LAYER_NOT_DRAWN); |
| 74 clipping_window_.set_owned_by_parent(false); | 74 clipping_window_.set_owned_by_parent(false); |
| 75 clipping_window_.SetName("NativeViewHostAuraClip"); | 75 clipping_window_.SetName("NativeViewHostAuraClip"); |
| 76 clipping_window_.layer()->SetMasksToBounds(true); | 76 clipping_window_.layer()->SetMasksToBounds(true); |
| 77 clipping_window_.SetProperty(views::kHostViewKey, static_cast<View*>(host_)); | 77 clipping_window_.SetProperty(views::kHostViewKey, static_cast<View*>(host_)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 NativeViewHostAura::~NativeViewHostAura() { | 80 NativeViewHostAura::~NativeViewHostAura() { |
| 81 if (host_->native_view()) { | 81 if (host_->native_view()) { |
| 82 host_->native_view()->RemoveObserver(this); | 82 host_->native_view()->RemoveObserver(this); |
| 83 host_->native_view()->ClearProperty(views::kHostViewKey); | 83 host_->native_view()->ClearProperty(views::kHostViewKey); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } else { | 229 } else { |
| 230 clipping_window_.RemoveChild(host_->native_view()); | 230 clipping_window_.RemoveChild(host_->native_view()); |
| 231 } | 231 } |
| 232 host_->native_view()->SetBounds(clipping_window_.bounds()); | 232 host_->native_view()->SetBounds(clipping_window_.bounds()); |
| 233 } | 233 } |
| 234 if (clipping_window_.parent()) | 234 if (clipping_window_.parent()) |
| 235 clipping_window_.parent()->RemoveChild(&clipping_window_); | 235 clipping_window_.parent()->RemoveChild(&clipping_window_); |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace views | 238 } // namespace views |
| OLD | NEW |