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

Unified Diff: ui/views/mus/mus_client.cc

Issue 2514243002: Propagates window type properties during aura-mus window creation (Closed)
Patch Set: merge 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
« no previous file with comments | « ui/views/mus/mus_client.h ('k') | ui/views/test/native_widget_factory_aura_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/mus_client.cc
diff --git a/ui/views/mus/mus_client.cc b/ui/views/mus/mus_client.cc
index 3b2b4139c7a83ff926505701bbba8712cc0dd4df..22e4e38f2b6d6c915f290d4058e910af5efe566f 100644
--- a/ui/views/mus/mus_client.cc
+++ b/ui/views/mus/mus_client.cc
@@ -9,7 +9,9 @@
#include "services/service_manager/public/cpp/connection.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/ui/public/cpp/gpu/gpu_service.h"
+#include "services/ui/public/cpp/property_type_converters.h"
#include "services/ui/public/interfaces/event_matcher.mojom.h"
+#include "services/ui/public/interfaces/window_manager.mojom.h"
#include "ui/aura/env.h"
#include "ui/aura/mus/mus_context_factory.h"
#include "ui/aura/mus/os_exchange_data_provider_mus.h"
@@ -27,6 +29,25 @@
#include "ui/wm/core/capture_controller.h"
#include "ui/wm/core/wm_state.h"
+// Widget::InitParams::Type must match that of ui::mojom::WindowType.
+#define WINDOW_TYPES_MATCH(NAME) \
+ static_assert( \
+ static_cast<int32_t>(views::Widget::InitParams::TYPE_##NAME) == \
+ static_cast<int32_t>(ui::mojom::WindowType::NAME), \
+ "Window type constants must match")
+
+WINDOW_TYPES_MATCH(WINDOW);
+WINDOW_TYPES_MATCH(PANEL);
+WINDOW_TYPES_MATCH(WINDOW_FRAMELESS);
+WINDOW_TYPES_MATCH(CONTROL);
+WINDOW_TYPES_MATCH(POPUP);
+WINDOW_TYPES_MATCH(MENU);
+WINDOW_TYPES_MATCH(TOOLTIP);
+WINDOW_TYPES_MATCH(BUBBLE);
+WINDOW_TYPES_MATCH(DRAG);
+// ui::mojom::WindowType::UNKNOWN does not correspond to a value in
+// Widget::InitParams::Type.
+
namespace views {
// static
@@ -57,6 +78,19 @@ bool MusClient::ShouldCreateDesktopNativeWidgetAura(
!init_params.child;
}
+// static
+std::map<std::string, std::vector<uint8_t>>
+MusClient::ConfigurePropertiesFromParams(
+ const Widget::InitParams& init_params) {
+ std::map<std::string, std::vector<uint8_t>> mus_properties =
+ init_params.mus_properties;
+ // Widget::InitParams::Type matches ui::mojom::WindowType.
+ mus_properties[ui::mojom::WindowManager::kWindowType_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(
+ static_cast<int32_t>(init_params.type));
+ return mus_properties;
+}
+
NativeWidget* MusClient::CreateNativeWidget(
const Widget::InitParams& init_params,
internal::NativeWidgetDelegate* delegate) {
@@ -71,9 +105,11 @@ NativeWidget* MusClient::CreateNativeWidget(
native_widget->SetDesktopWindowTreeHost(
base::WrapUnique(init_params.desktop_window_tree_host));
} else {
+ std::map<std::string, std::vector<uint8_t>> mus_properties =
+ ConfigurePropertiesFromParams(init_params);
native_widget->SetDesktopWindowTreeHost(
base::MakeUnique<DesktopWindowTreeHostMus>(delegate, native_widget,
- init_params));
+ &mus_properties));
}
return native_widget;
}
« no previous file with comments | « ui/views/mus/mus_client.h ('k') | ui/views/test/native_widget_factory_aura_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698