OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/sysui/container_delegate_mus.h" | 5 #include "ash/sysui/container_delegate_mus.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include "ash/public/interfaces/container.mojom.h" |
9 #include "components/mus/public/cpp/property_type_converters.h" | 10 #include "components/mus/public/cpp/property_type_converters.h" |
10 #include "components/mus/public/cpp/window.h" | 11 #include "components/mus/public/cpp/window.h" |
11 #include "components/mus/public/cpp/window_property.h" | 12 #include "components/mus/public/cpp/window_property.h" |
12 #include "mash/wm/public/interfaces/container.mojom.h" | |
13 #include "ui/aura/mus/mus_util.h" | 13 #include "ui/aura/mus/mus_util.h" |
14 #include "ui/views/mus/native_widget_mus.h" | 14 #include "ui/views/mus/native_widget_mus.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
16 | 16 |
17 using mash::wm::mojom::Container; | |
18 | |
19 namespace ash { | 17 namespace ash { |
20 namespace sysui { | 18 namespace sysui { |
21 | 19 |
22 namespace { | 20 namespace { |
23 | 21 |
24 // Returns true if |widget| is in |container|. | 22 // Returns true if |widget| is in |container|. |
25 bool IsInContainer(views::Widget* widget, Container container) { | 23 bool IsInContainer(views::Widget* widget, mojom::Container container) { |
26 mus::Window* window = | 24 mus::Window* window = |
27 aura::GetMusWindow(widget->GetTopLevelWidget()->GetNativeWindow()); | 25 aura::GetMusWindow(widget->GetTopLevelWidget()->GetNativeWindow()); |
28 if (window->HasSharedProperty(mash::wm::mojom::kWindowContainer_Property)) | 26 if (window->HasSharedProperty(mojom::kWindowContainer_Property)) |
29 return container == | 27 return container == |
30 static_cast<Container>(window->GetSharedProperty<int32_t>( | 28 static_cast<mojom::Container>(window->GetSharedProperty<int32_t>( |
31 mash::wm::mojom::kWindowContainer_Property)); | 29 mojom::kWindowContainer_Property)); |
32 | 30 |
33 return false; | 31 return false; |
34 } | 32 } |
35 | 33 |
36 } // namespace | 34 } // namespace |
37 | 35 |
38 ContainerDelegateMus::ContainerDelegateMus() {} | 36 ContainerDelegateMus::ContainerDelegateMus() {} |
39 | 37 |
40 ContainerDelegateMus::~ContainerDelegateMus() {} | 38 ContainerDelegateMus::~ContainerDelegateMus() {} |
41 | 39 |
42 bool ContainerDelegateMus::IsInMenuContainer(views::Widget* widget) { | 40 bool ContainerDelegateMus::IsInMenuContainer(views::Widget* widget) { |
43 return IsInContainer(widget, Container::MENUS); | 41 return IsInContainer(widget, mojom::Container::MENUS); |
44 } | 42 } |
45 | 43 |
46 bool ContainerDelegateMus::IsInStatusContainer(views::Widget* widget) { | 44 bool ContainerDelegateMus::IsInStatusContainer(views::Widget* widget) { |
47 return IsInContainer(widget, Container::STATUS); | 45 return IsInContainer(widget, mojom::Container::STATUS); |
48 } | 46 } |
49 | 47 |
50 } // namespace sysui | 48 } // namespace sysui |
51 } // namespace ash | 49 } // namespace ash |
OLD | NEW |