Chromium Code Reviews| Index: ui/aura/mus/window_tree_client.cc |
| diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc |
| index 6ae11599f15d21690585153600802a395c955670..06039f81a77de3513d7a973503d88d8b0268acc6 100644 |
| --- a/ui/aura/mus/window_tree_client.cc |
| +++ b/ui/aura/mus/window_tree_client.cc |
| @@ -14,7 +14,9 @@ |
| #include "base/bind.h" |
| #include "base/memory/ptr_util.h" |
| #include "services/service_manager/public/cpp/connector.h" |
| +#include "services/ui/public/cpp/property_type_converters.h" |
| #include "services/ui/public/interfaces/constants.mojom.h" |
| +#include "services/ui/public/interfaces/window_manager.mojom.h" |
| #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom.h" |
| #include "ui/aura/client/aura_constants.h" |
| #include "ui/aura/client/drag_drop_client.h" |
| @@ -25,6 +27,7 @@ |
| #include "ui/aura/mus/in_flight_change.h" |
| #include "ui/aura/mus/input_method_mus.h" |
| #include "ui/aura/mus/property_converter.h" |
| +#include "ui/aura/mus/property_utils.h" |
| #include "ui/aura/mus/surface_id_handler.h" |
| #include "ui/aura/mus/window_manager_delegate.h" |
| #include "ui/aura/mus/window_mus.h" |
| @@ -119,6 +122,20 @@ bool IsInternalProperty(const void* key) { |
| return key == client::kModalKey; |
| } |
| +void SetWindowTypeFromProperties( |
| + Window* window, |
| + const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties) { |
| + auto type_iter = |
| + properties.find(ui::mojom::WindowManager::kWindowType_Property); |
| + if (type_iter == properties.end()) |
| + return; |
| + |
| + // TODO: need to validate type! http://crbug.com/654924. |
| + ui::mojom::WindowType window_type = static_cast<ui::mojom::WindowType>( |
| + mojo::ConvertTo<int32_t>(type_iter->second.To<std::vector<uint8_t>>())); |
| + SetWindowType(window, window_type); |
| +} |
| + |
| // Helper function to get the device_scale_factor() of the display::Display |
| // with |display_id|. |
| float ScaleFactorForDisplay(Window* window) { |
| @@ -406,6 +423,7 @@ WindowMus* WindowTreeClient::NewWindowFromWindowData( |
| WindowPortMus* window_port_mus_ptr = window_port_mus.get(); |
| Window* window = new Window(nullptr, std::move(window_port_mus)); |
| WindowMus* window_mus = window_port_mus_ptr; |
| + SetWindowTypeFromProperties(window, window_data->properties); |
| window->Init(ui::LAYER_NOT_DRAWN); |
| SetLocalPropertiesFromServerProperties(window_mus, window_data); |
| window_mus->SetBoundsFromServer(window_data->bounds); |
| @@ -749,9 +767,6 @@ void WindowTreeClient::OnWmMoveLoopCompleted(uint32_t change_id, |
| } |
| } |
| -//////////////////////////////////////////////////////////////////////////////// |
| -// WindowTreeClient, WindowTreeClient implementation: |
| - |
| std::set<Window*> WindowTreeClient::GetRoots() { |
| std::set<Window*> roots; |
| for (WindowMus* window : roots_) |
| @@ -803,9 +818,6 @@ void WindowTreeClient::CancelWindowMove(Window* window) { |
| tree_->CancelWindowMove(WindowMus::Get(window)->server_id()); |
| } |
| -//////////////////////////////////////////////////////////////////////////////// |
| -// WindowTreeClient, WindowTreeClient implementation: |
| - |
| void WindowTreeClient::AddObserver(WindowTreeClientObserver* observer) { |
| observers_.AddObserver(observer); |
| } |
| @@ -1375,8 +1387,18 @@ void WindowTreeClient::WmCreateTopLevelWindow( |
| mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) { |
| std::map<std::string, std::vector<uint8_t>> properties = |
| transport_properties.To<std::map<std::string, std::vector<uint8_t>>>(); |
| - Window* window = |
| - window_manager_delegate_->OnWmCreateTopLevelWindow(&properties); |
| + ui::mojom::WindowType window_type; |
|
msw
2016/11/21 19:26:47
nit: assign an explicit default value?
sky
2016/11/21 22:13:56
Done.
|
| + ui::mojom::WindowType* window_type_ptr = nullptr; |
| + auto type_iter = |
| + properties.find(ui::mojom::WindowManager::kWindowType_Property); |
| + if (type_iter != properties.end()) { |
| + // TODO: validation! |
|
msw
2016/11/21 19:26:47
nit: cite http://crbug.com/654924 like above?
sky
2016/11/21 22:13:56
Done.
|
| + window_type = static_cast<ui::mojom::WindowType>( |
| + mojo::ConvertTo<int32_t>(type_iter->second)); |
| + window_type_ptr = &window_type; |
| + } |
| + Window* window = window_manager_delegate_->OnWmCreateTopLevelWindow( |
| + window_type_ptr, &properties); |
| embedded_windows_[requesting_client_id].insert(window); |
| if (window_manager_internal_client_) { |
| window_manager_internal_client_->OnWmCreatedTopLevelWindow( |