Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: ui/aura/mus/property_utils.cc

Issue 2514243002: Propagates window type properties during aura-mus window creation (Closed)
Patch Set: return Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/aura/mus/property_utils.cc
diff --git a/ui/aura/mus/property_utils.cc b/ui/aura/mus/property_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..947bfa66a7f30b12085e7952598d74bbcf4a7ca2
--- /dev/null
+++ b/ui/aura/mus/property_utils.cc
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/aura/mus/property_utils.h"
+
+#include "services/ui/public/interfaces/window_manager_constants.mojom.h"
+#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/window.h"
+#include "ui/wm/public/window_types.h"
+
+namespace aura {
+namespace {
+
+ui::wm::WindowType UiWindowTypeToWmWindowType(ui::mojom::WindowType type) {
+ switch (type) {
+ case ui::mojom::WindowType::WINDOW:
+ return ui::wm::WINDOW_TYPE_NORMAL;
+ case ui::mojom::WindowType::PANEL:
+ return ui::wm::WINDOW_TYPE_PANEL;
+ case ui::mojom::WindowType::CONTROL:
+ return ui::wm::WINDOW_TYPE_CONTROL;
+ case ui::mojom::WindowType::WINDOW_FRAMELESS:
+ case ui::mojom::WindowType::POPUP:
+ case ui::mojom::WindowType::BUBBLE:
+ case ui::mojom::WindowType::DRAG:
+ return ui::wm::WINDOW_TYPE_POPUP;
+ case ui::mojom::WindowType::MENU:
+ return ui::wm::WINDOW_TYPE_MENU;
+ case ui::mojom::WindowType::TOOLTIP:
+ return ui::wm::WINDOW_TYPE_TOOLTIP;
+ }
+ 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
+}
+
+} // namespace
+
+void SetWindowType(Window* window, ui::mojom::WindowType window_type) {
+ std::unique_ptr<client::WindowTypeProperty> window_type_property =
+ base::MakeUnique<client::WindowTypeProperty>();
+ window_type_property->type = window_type;
+ window->SetProperty(client::kWindowTypeKey, window_type_property.release());
+ window->SetType(UiWindowTypeToWmWindowType(window_type));
+}
+
+} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698