OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mash/wm/window_manager_impl.h" | 5 #include "mash/wm/window_manager_impl.h" |
6 | 6 |
7 #include "components/mus/common/types.h" | 7 #include "components/mus/common/types.h" |
8 #include "components/mus/public/cpp/property_type_converters.h" | 8 #include "components/mus/public/cpp/property_type_converters.h" |
9 #include "components/mus/public/cpp/window.h" | 9 #include "components/mus/public/cpp/window.h" |
10 #include "components/mus/public/cpp/window_property.h" | 10 #include "components/mus/public/cpp/window_property.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 child_window->SetBounds(CalculateDefaultBounds(child_window)); | 78 child_window->SetBounds(CalculateDefaultBounds(child_window)); |
79 GetContainerForChild(child_window)->AddChild(child_window); | 79 GetContainerForChild(child_window)->AddChild(child_window); |
80 child_window->Embed(client.Pass()); | 80 child_window->Embed(client.Pass()); |
81 | 81 |
82 // NonClientFrameController deletes itself when the window is destroyed. | 82 // NonClientFrameController deletes itself when the window is destroyed. |
83 new NonClientFrameController(state_->app()->shell(), child_window); | 83 new NonClientFrameController(state_->app()->shell(), child_window); |
84 | 84 |
85 state_->IncrementWindowCount(); | 85 state_->IncrementWindowCount(); |
86 } | 86 } |
87 | 87 |
88 void WindowManagerImpl::SetPreferredSize( | |
89 mus::Id window_id, | |
90 mojo::SizePtr size, | |
91 const WindowManagerErrorCodeCallback& callback) { | |
92 mus::Window* window = state_->GetWindowById(window_id); | |
93 if (window) | |
94 SetWindowPreferredSize(window, size.To<gfx::Size>()); | |
95 | |
96 callback.Run(window | |
97 ? mus::mojom::WINDOW_MANAGER_ERROR_CODE_SUCCESS | |
98 : mus::mojom::WINDOW_MANAGER_ERROR_CODE_ERROR_ACCESS_DENIED); | |
99 } | |
100 | |
101 void WindowManagerImpl::SetResizeBehavior( | |
102 uint32_t window_id, | |
103 mus::mojom::ResizeBehavior resize_behavior) { | |
104 mus::Window* window = state_->GetWindowById(window_id); | |
105 if (window) { | |
106 window->SetSharedProperty<int32_t>( | |
107 mus::mojom::WindowManager::kResizeBehavior_Property, resize_behavior); | |
108 } | |
109 } | |
110 | |
111 void WindowManagerImpl::GetConfig(const GetConfigCallback& callback) { | 88 void WindowManagerImpl::GetConfig(const GetConfigCallback& callback) { |
112 mus::mojom::WindowManagerConfigPtr config( | 89 mus::mojom::WindowManagerConfigPtr config( |
113 mus::mojom::WindowManagerConfig::New()); | 90 mus::mojom::WindowManagerConfig::New()); |
114 config->displays = mojo::Array<mus::mojom::DisplayPtr>::New(1); | 91 config->displays = mojo::Array<mus::mojom::DisplayPtr>::New(1); |
115 config->displays[0] = mus::mojom::Display::New(); | 92 config->displays[0] = mus::mojom::Display::New(); |
116 config->displays[0]->id = 2001; | 93 config->displays[0]->id = 2001; |
117 config->displays[0]->bounds = mojo::Rect::New(); | 94 config->displays[0]->bounds = mojo::Rect::New(); |
118 config->displays[0]->bounds->y = 0; | 95 config->displays[0]->bounds->y = 0; |
119 config->displays[0]->bounds->width = state_->root()->bounds().width(); | 96 config->displays[0]->bounds->width = state_->root()->bounds().width(); |
120 config->displays[0]->bounds->height = state_->root()->bounds().width(); | 97 config->displays[0]->bounds->height = state_->root()->bounds().width(); |
(...skipping 16 matching lines...) Expand all Loading... |
137 config->maximized_client_area_insets->right = 0; | 114 config->maximized_client_area_insets->right = 0; |
138 config->maximized_client_area_insets->bottom = 0; | 115 config->maximized_client_area_insets->bottom = 0; |
139 | 116 |
140 callback.Run(config.Pass()); | 117 callback.Run(config.Pass()); |
141 } | 118 } |
142 | 119 |
143 mus::Window* WindowManagerImpl::GetContainerForChild(mus::Window* child) { | 120 mus::Window* WindowManagerImpl::GetContainerForChild(mus::Window* child) { |
144 mash::wm::mojom::Container container = GetRequestedContainer(child); | 121 mash::wm::mojom::Container container = GetRequestedContainer(child); |
145 return state_->GetWindowForContainer(container); | 122 return state_->GetWindowForContainer(container); |
146 } | 123 } |
OLD | NEW |