Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This has to be before any other includes, else default is picked up. | 5 // This has to be before any other includes, else default is picked up. |
| 6 // See base/logging for details on this. | 6 // See base/logging for details on this. |
| 7 #define NOTIMPLEMENTED_POLICY 5 | 7 #define NOTIMPLEMENTED_POLICY 5 |
| 8 | 8 |
| 9 #include "ui/views/mus/native_widget_mus.h" | 9 #include "ui/views/mus/native_widget_mus.h" |
| 10 | 10 |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 768 | 768 |
| 769 content_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 769 content_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 770 content_->Init(params.layer_type); | 770 content_->Init(params.layer_type); |
| 771 if (window_->visible()) | 771 if (window_->visible()) |
| 772 content_->Show(); | 772 content_->Show(); |
| 773 content_->SetTransparent(true); | 773 content_->SetTransparent(true); |
| 774 content_->SetFillsBoundsCompletely(false); | 774 content_->SetFillsBoundsCompletely(false); |
| 775 content_->set_ignore_events(!params.accept_events); | 775 content_->set_ignore_events(!params.accept_events); |
| 776 hosted_window->AddChild(content_); | 776 hosted_window->AddChild(content_); |
| 777 | 777 |
| 778 if (params.parent_mus) | |
|
mfomitchev
2016/11/07 18:19:23
Can we make it so we only do AddChild once? Someth
thanhph
2016/11/07 19:50:56
Thanks. I also add the if condition to prevent SEG
mfomitchev
2016/11/07 20:16:47
Cool, thanks!
| |
| 779 params.parent_mus->AddChild(window_); | |
| 780 | |
| 778 // Set-up transiency if appropriate. | 781 // Set-up transiency if appropriate. |
| 779 if (params.parent && !params.child) { | 782 if (params.parent && !params.child) { |
| 780 aura::Window* parent_root = params.parent->GetRootWindow(); | 783 aura::Window* parent_root = params.parent->GetRootWindow(); |
| 781 ui::Window* parent_mus = parent_root->GetProperty(kMusWindow); | 784 ui::Window* parent_mus = parent_root->GetProperty(kMusWindow); |
| 782 if (parent_mus) | 785 if (parent_mus) { |
| 783 parent_mus->AddTransientWindow(window_); | 786 parent_mus->AddTransientWindow(window_); |
| 787 if (!params.parent_mus) | |
| 788 parent_mus->AddChild(window_); | |
| 789 } | |
| 784 } | 790 } |
| 785 | 791 |
| 786 if (params.parent_mus) | |
| 787 params.parent_mus->AddChild(window_); | |
| 788 | |
| 789 // TODO(sky): deal with show state. | 792 // TODO(sky): deal with show state. |
| 790 if (!params.bounds.size().IsEmpty()) | 793 if (!params.bounds.size().IsEmpty()) |
| 791 SetBounds(params.bounds); | 794 SetBounds(params.bounds); |
| 792 | 795 |
| 793 // TODO(beng): much else, see [Desktop]NativeWidgetAura. | 796 // TODO(beng): much else, see [Desktop]NativeWidgetAura. |
| 794 | 797 |
| 795 native_widget_delegate_->OnNativeWidgetCreated(false); | 798 native_widget_delegate_->OnNativeWidgetCreated(false); |
| 796 } | 799 } |
| 797 | 800 |
| 798 void NativeWidgetMus::OnWidgetInitDone() { | 801 void NativeWidgetMus::OnWidgetInitDone() { |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1569 | 1572 |
| 1570 gfx::Path mask_path; | 1573 gfx::Path mask_path; |
| 1571 native_widget_delegate_->GetHitTestMask(&mask_path); | 1574 native_widget_delegate_->GetHitTestMask(&mask_path); |
| 1572 // TODO(jamescook): Use the full path for the mask. | 1575 // TODO(jamescook): Use the full path for the mask. |
| 1573 gfx::Rect mask_rect = | 1576 gfx::Rect mask_rect = |
| 1574 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1577 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
| 1575 window_->SetHitTestMask(mask_rect); | 1578 window_->SetHitTestMask(mask_rect); |
| 1576 } | 1579 } |
| 1577 | 1580 |
| 1578 } // namespace views | 1581 } // namespace views |
| OLD | NEW |