| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "components/mus/common/types.h" | 10 #include "components/mus/common/types.h" |
| 10 #include "components/mus/public/cpp/property_type_converters.h" | 11 #include "components/mus/public/cpp/property_type_converters.h" |
| 11 #include "components/mus/public/cpp/window.h" | 12 #include "components/mus/public/cpp/window.h" |
| 12 #include "components/mus/public/cpp/window_property.h" | 13 #include "components/mus/public/cpp/window_property.h" |
| 13 #include "components/mus/public/cpp/window_tree_connection.h" | 14 #include "components/mus/public/cpp/window_tree_connection.h" |
| 14 #include "components/mus/public/interfaces/input_events.mojom.h" | 15 #include "components/mus/public/interfaces/input_events.mojom.h" |
| 15 #include "components/mus/public/interfaces/mus_constants.mojom.h" | 16 #include "components/mus/public/interfaces/mus_constants.mojom.h" |
| 16 #include "components/mus/public/interfaces/window_manager.mojom.h" | 17 #include "components/mus/public/interfaces/window_manager.mojom.h" |
| 17 #include "mash/wm/non_client_frame_controller.h" | 18 #include "mash/wm/non_client_frame_controller.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 GetWindowType(properties) == mus::mojom::WINDOW_TYPE_WINDOW; | 109 GetWindowType(properties) == mus::mojom::WINDOW_TYPE_WINDOW; |
| 109 if (provide_non_client_frame) | 110 if (provide_non_client_frame) |
| 110 properties[mus::mojom::kWaitForUnderlay_Property].clear(); | 111 properties[mus::mojom::kWaitForUnderlay_Property].clear(); |
| 111 | 112 |
| 112 // TODO(sky): constrain and validate properties before passing to server. | 113 // TODO(sky): constrain and validate properties before passing to server. |
| 113 mus::Window* child_window = root->connection()->NewWindow(&properties); | 114 mus::Window* child_window = root->connection()->NewWindow(&properties); |
| 114 child_window->SetBounds(CalculateDefaultBounds(child_window)); | 115 child_window->SetBounds(CalculateDefaultBounds(child_window)); |
| 115 | 116 |
| 116 mojom::Container container = GetRequestedContainer(child_window); | 117 mojom::Container container = GetRequestedContainer(child_window); |
| 117 state_->GetWindowForContainer(container)->AddChild(child_window); | 118 state_->GetWindowForContainer(container)->AddChild(child_window); |
| 118 child_window->Embed(client.Pass()); | 119 child_window->Embed(std::move(client)); |
| 119 | 120 |
| 120 if (provide_non_client_frame) { | 121 if (provide_non_client_frame) { |
| 121 // NonClientFrameController deletes itself when |child_window| is destroyed. | 122 // NonClientFrameController deletes itself when |child_window| is destroyed. |
| 122 new NonClientFrameController(state_->app()->shell(), child_window, | 123 new NonClientFrameController(state_->app()->shell(), child_window, |
| 123 state_->window_tree_host()); | 124 state_->window_tree_host()); |
| 124 } | 125 } |
| 125 | 126 |
| 126 state_->IncrementWindowCount(); | 127 state_->IncrementWindowCount(); |
| 127 } | 128 } |
| 128 | 129 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 146 // from it. | 147 // from it. |
| 147 const gfx::Insets client_area_insets = | 148 const gfx::Insets client_area_insets = |
| 148 NonClientFrameController::GetPreferredClientAreaInsets(); | 149 NonClientFrameController::GetPreferredClientAreaInsets(); |
| 149 config->normal_client_area_insets = mojo::Insets::From(client_area_insets); | 150 config->normal_client_area_insets = mojo::Insets::From(client_area_insets); |
| 150 | 151 |
| 151 config->maximized_client_area_insets = mojo::Insets::From(client_area_insets); | 152 config->maximized_client_area_insets = mojo::Insets::From(client_area_insets); |
| 152 | 153 |
| 153 config->max_title_bar_button_width = | 154 config->max_title_bar_button_width = |
| 154 NonClientFrameController::GetMaxTitleBarButtonWidth(); | 155 NonClientFrameController::GetMaxTitleBarButtonWidth(); |
| 155 | 156 |
| 156 callback.Run(config.Pass()); | 157 callback.Run(std::move(config)); |
| 157 } | 158 } |
| 158 | 159 |
| 159 bool WindowManagerImpl::OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) { | 160 bool WindowManagerImpl::OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) { |
| 160 // By returning true the bounds of |window| is updated. | 161 // By returning true the bounds of |window| is updated. |
| 161 return true; | 162 return true; |
| 162 } | 163 } |
| 163 | 164 |
| 164 bool WindowManagerImpl::OnWmSetProperty( | 165 bool WindowManagerImpl::OnWmSetProperty( |
| 165 mus::Window* window, | 166 mus::Window* window, |
| 166 const std::string& name, | 167 const std::string& name, |
| 167 scoped_ptr<std::vector<uint8_t>>* new_data) { | 168 scoped_ptr<std::vector<uint8_t>>* new_data) { |
| 168 // TODO(sky): constrain this to set of keys we know about, and allowed | 169 // TODO(sky): constrain this to set of keys we know about, and allowed |
| 169 // values. | 170 // values. |
| 170 return name == mus::mojom::WindowManager::kShowState_Property || | 171 return name == mus::mojom::WindowManager::kShowState_Property || |
| 171 name == mus::mojom::WindowManager::kPreferredSize_Property || | 172 name == mus::mojom::WindowManager::kPreferredSize_Property || |
| 172 name == mus::mojom::WindowManager::kResizeBehavior_Property || | 173 name == mus::mojom::WindowManager::kResizeBehavior_Property || |
| 173 name == mus::mojom::WindowManager::kWindowTitle_Property; | 174 name == mus::mojom::WindowManager::kWindowTitle_Property; |
| 174 } | 175 } |
| 175 | 176 |
| 176 } // namespace wm | 177 } // namespace wm |
| 177 } // namespace mash | 178 } // namespace mash |
| OLD | NEW |