Chromium Code Reviews| 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 "ui/aura/mus/property_utils.h" | |
| 6 | |
| 7 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | |
| 8 #include "ui/aura/client/aura_constants.h" | |
| 9 #include "ui/aura/window.h" | |
| 10 #include "ui/wm/public/window_types.h" | |
| 11 | |
| 12 namespace aura { | |
| 13 namespace { | |
| 14 | |
| 15 ui::wm::WindowType UiWindowTypeToWmWindowType(ui::mojom::WindowType type) { | |
| 16 switch (type) { | |
| 17 case ui::mojom::WindowType::WINDOW: | |
| 18 return ui::wm::WINDOW_TYPE_NORMAL; | |
| 19 case ui::mojom::WindowType::PANEL: | |
| 20 return ui::wm::WINDOW_TYPE_PANEL; | |
| 21 case ui::mojom::WindowType::CONTROL: | |
| 22 return ui::wm::WINDOW_TYPE_CONTROL; | |
| 23 case ui::mojom::WindowType::WINDOW_FRAMELESS: | |
| 24 case ui::mojom::WindowType::POPUP: | |
| 25 case ui::mojom::WindowType::BUBBLE: | |
| 26 case ui::mojom::WindowType::DRAG: | |
| 27 return ui::wm::WINDOW_TYPE_POPUP; | |
| 28 case ui::mojom::WindowType::MENU: | |
| 29 return ui::wm::WINDOW_TYPE_MENU; | |
| 30 case ui::mojom::WindowType::TOOLTIP: | |
| 31 return ui::wm::WINDOW_TYPE_TOOLTIP; | |
| 32 } | |
| 33 return ui::wm::WINDOW_TYPE_POPUP; | |
|
msw
2016/11/21 19:26:46
Should this return WINDOW_TYPE_UNKNOWN?
sky
2016/11/21 22:13:56
This case should never be hit, but you're right, U
| |
| 34 } | |
| 35 | |
| 36 } // namespace | |
| 37 | |
| 38 void SetWindowType(Window* window, ui::mojom::WindowType window_type) { | |
| 39 std::unique_ptr<client::WindowTypeProperty> window_type_property = | |
| 40 base::MakeUnique<client::WindowTypeProperty>(); | |
| 41 window_type_property->type = window_type; | |
| 42 window->SetProperty(client::kWindowTypeKey, window_type_property.release()); | |
| 43 window->SetType(UiWindowTypeToWmWindowType(window_type)); | |
| 44 } | |
| 45 | |
| 46 } // namespace aura | |
| OLD | NEW |