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/widget/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/aura/client/stacking_client.h" | 8 #include "ui/aura/client/stacking_client.h" |
9 #include "ui/aura/focus_manager.h" | 9 #include "ui/aura/focus_manager.h" |
10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ui/views/widget/widget_aura_utils.h" | 22 #include "ui/views/widget/widget_aura_utils.h" |
23 | 23 |
24 DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(VIEWS_EXPORT, | 24 DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(VIEWS_EXPORT, |
25 views::DesktopNativeWidgetAura*); | 25 views::DesktopNativeWidgetAura*); |
26 | 26 |
27 namespace views { | 27 namespace views { |
28 | 28 |
29 DEFINE_WINDOW_PROPERTY_KEY(DesktopNativeWidgetAura*, | 29 DEFINE_WINDOW_PROPERTY_KEY(DesktopNativeWidgetAura*, |
30 kDesktopNativeWidgetAuraKey, NULL); | 30 kDesktopNativeWidgetAuraKey, NULL); |
31 | 31 |
32 namespace { | |
33 | |
34 class DesktopNativeWidgetAuraStackingClient : | |
35 public aura::client::StackingClient { | |
36 public: | |
37 explicit DesktopNativeWidgetAuraStackingClient(aura::RootWindow* root_window) | |
38 : root_window_(root_window) { | |
39 aura::client::SetStackingClient(root_window_, this); | |
40 } | |
41 virtual ~DesktopNativeWidgetAuraStackingClient() { | |
42 aura::client::SetStackingClient(root_window_, NULL); | |
43 } | |
44 | |
45 // Overridden from client::StackingClient: | |
46 virtual aura::Window* GetDefaultParent(aura::Window* window, | |
47 const gfx::Rect& bounds) OVERRIDE { | |
48 return root_window_; | |
49 } | |
50 | |
51 private: | |
52 aura::RootWindow* root_window_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAuraStackingClient); | |
55 }; | |
56 | |
57 } // namespace | |
58 | |
59 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
60 // DesktopNativeWidgetAura, public: | 33 // DesktopNativeWidgetAura, public: |
61 | 34 |
62 DesktopNativeWidgetAura::DesktopNativeWidgetAura( | 35 DesktopNativeWidgetAura::DesktopNativeWidgetAura( |
63 internal::NativeWidgetDelegate* delegate) | 36 internal::NativeWidgetDelegate* delegate) |
64 : ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), | 37 : ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), |
65 ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)), | 38 ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)), |
66 can_activate_(true), | 39 can_activate_(true), |
67 desktop_root_window_host_(NULL), | 40 desktop_root_window_host_(NULL), |
68 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), | 41 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 window_->SetTransparent(true); | 74 window_->SetTransparent(true); |
102 window_->Init(params.layer_type); | 75 window_->Init(params.layer_type); |
103 window_->Show(); | 76 window_->Show(); |
104 | 77 |
105 desktop_root_window_host_ = params.desktop_root_window_host ? | 78 desktop_root_window_host_ = params.desktop_root_window_host ? |
106 params.desktop_root_window_host : | 79 params.desktop_root_window_host : |
107 DesktopRootWindowHost::Create(native_widget_delegate_, | 80 DesktopRootWindowHost::Create(native_widget_delegate_, |
108 this, params.bounds); | 81 this, params.bounds); |
109 root_window_.reset( | 82 root_window_.reset( |
110 desktop_root_window_host_->Init(window_, params)); | 83 desktop_root_window_host_->Init(window_, params)); |
111 stacking_client_.reset( | |
112 new DesktopNativeWidgetAuraStackingClient(root_window_.get())); | |
113 | 84 |
114 aura::client::SetActivationDelegate(window_, this); | 85 aura::client::SetActivationDelegate(window_, this); |
115 } | 86 } |
116 | 87 |
117 NonClientFrameView* DesktopNativeWidgetAura::CreateNonClientFrameView() { | 88 NonClientFrameView* DesktopNativeWidgetAura::CreateNonClientFrameView() { |
118 return desktop_root_window_host_->CreateNonClientFrameView(); | 89 return desktop_root_window_host_->CreateNonClientFrameView(); |
119 } | 90 } |
120 | 91 |
121 bool DesktopNativeWidgetAura::ShouldUseNativeFrame() const { | 92 bool DesktopNativeWidgetAura::ShouldUseNativeFrame() const { |
122 return desktop_root_window_host_->ShouldUseNativeFrame(); | 93 return desktop_root_window_host_->ShouldUseNativeFrame(); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 GetWidget()->non_client_view()->SchedulePaint(); | 542 GetWidget()->non_client_view()->SchedulePaint(); |
572 } | 543 } |
573 | 544 |
574 void DesktopNativeWidgetAura::OnLostActive() { | 545 void DesktopNativeWidgetAura::OnLostActive() { |
575 native_widget_delegate_->OnNativeWidgetActivationChanged(false); | 546 native_widget_delegate_->OnNativeWidgetActivationChanged(false); |
576 if (IsVisible() && GetWidget()->non_client_view()) | 547 if (IsVisible() && GetWidget()->non_client_view()) |
577 GetWidget()->non_client_view()->SchedulePaint(); | 548 GetWidget()->non_client_view()->SchedulePaint(); |
578 } | 549 } |
579 | 550 |
580 } // namespace views | 551 } // namespace views |
OLD | NEW |