OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/mus/container_delegate_mus.h" |
| 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include "components/mus/public/cpp/property_type_converters.h" |
| 10 #include "components/mus/public/cpp/window.h" |
| 11 #include "components/mus/public/cpp/window_property.h" |
| 12 #include "mash/wm/public/interfaces/container.mojom.h" |
| 13 #include "ui/views/mus/native_widget_mus.h" |
| 14 #include "ui/views/widget/widget.h" |
| 15 |
| 16 using mash::wm::mojom::Container; |
| 17 |
| 18 namespace ash { |
| 19 namespace sysui { |
| 20 |
| 21 namespace { |
| 22 |
| 23 // Returns true if a top-level |widget| is in |container|. |
| 24 bool IsInContainer(views::Widget* widget, Container container) { |
| 25 mus::Window* window = static_cast<views::NativeWidgetMus*>(widget |
| 26 ->native_widget())->window(); |
| 27 if (window->HasSharedProperty(mash::wm::mojom::kWindowContainer_Property)) { |
| 28 Container c = static_cast<Container>(window->GetSharedProperty<int32_t>( |
| 29 mash::wm::mojom::kWindowContainer_Property)); |
| 30 LOG(ERROR) << "JAMES IsInContainer got " << c; |
| 31 return container == c; //JAMES inline me |
| 32 } |
| 33 return false; |
| 34 } |
| 35 |
| 36 } // namespace |
| 37 |
| 38 ContainerDelegateMus::ContainerDelegateMus() {} |
| 39 |
| 40 ContainerDelegateMus::~ContainerDelegateMus() {} |
| 41 |
| 42 bool ContainerDelegateMus::IsInMenuContainer(views::Widget* widget) { |
| 43 return IsInContainer(widget, Container::MENUS); |
| 44 } |
| 45 |
| 46 bool ContainerDelegateMus::IsInStatusContainer(views::Widget* widget) { |
| 47 return IsInContainer(widget, Container::STATUS); |
| 48 } |
| 49 |
| 50 } // namespace sysui |
| 51 } // namespace ash |
OLD | NEW |