| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/mus/root_window_controller.h" | 5 #include "ash/mus/root_window_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <sstream> | 11 #include <sstream> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "ash/aura/wm_window_aura.h" | |
| 17 #include "ash/common/shelf/shelf_layout_manager.h" | 16 #include "ash/common/shelf/shelf_layout_manager.h" |
| 18 #include "ash/common/shelf/wm_shelf.h" | 17 #include "ash/common/shelf/wm_shelf.h" |
| 19 #include "ash/common/wm/container_finder.h" | 18 #include "ash/common/wm/container_finder.h" |
| 20 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 19 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 21 #include "ash/common/wm/panels/panel_layout_manager.h" | 20 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 22 #include "ash/common/wm/root_window_layout_manager.h" | 21 #include "ash/common/wm/root_window_layout_manager.h" |
| 22 #include "ash/common/wm_window.h" |
| 23 #include "ash/mus/bridge/wm_shell_mus.h" | 23 #include "ash/mus/bridge/wm_shell_mus.h" |
| 24 #include "ash/mus/non_client_frame_controller.h" | 24 #include "ash/mus/non_client_frame_controller.h" |
| 25 #include "ash/mus/property_util.h" | 25 #include "ash/mus/property_util.h" |
| 26 #include "ash/mus/screen_mus.h" | 26 #include "ash/mus/screen_mus.h" |
| 27 #include "ash/mus/window_manager.h" | 27 #include "ash/mus/window_manager.h" |
| 28 #include "ash/public/cpp/shell_window_ids.h" | 28 #include "ash/public/cpp/shell_window_ids.h" |
| 29 #include "ash/root_window_settings.h" | 29 #include "ash/root_window_settings.h" |
| 30 #include "base/bind.h" | 30 #include "base/bind.h" |
| 31 #include "base/command_line.h" | 31 #include "base/command_line.h" |
| 32 #include "base/memory/ptr_util.h" | 32 #include "base/memory/ptr_util.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 for (auto& property_pair : *properties) { | 154 for (auto& property_pair : *properties) { |
| 155 property_converter->SetPropertyFromTransportValue( | 155 property_converter->SetPropertyFromTransportValue( |
| 156 window, property_pair.first, &property_pair.second); | 156 window, property_pair.first, &property_pair.second); |
| 157 } | 157 } |
| 158 window->Init(ui::LAYER_TEXTURED); | 158 window->Init(ui::LAYER_TEXTURED); |
| 159 window->SetBounds(bounds); | 159 window->SetBounds(bounds); |
| 160 | 160 |
| 161 if (container_window) { | 161 if (container_window) { |
| 162 container_window->AddChild(window); | 162 container_window->AddChild(window); |
| 163 } else { | 163 } else { |
| 164 WmWindowAura* root = WmWindowAura::Get(this->root()); | 164 WmWindow* root = WmWindow::Get(this->root()); |
| 165 gfx::Point origin = | 165 gfx::Point origin = |
| 166 root->ConvertPointToTarget(root->GetRootWindow(), gfx::Point()); | 166 root->ConvertPointToTarget(root->GetRootWindow(), gfx::Point()); |
| 167 origin += display_.bounds().OffsetFromOrigin(); | 167 origin += display_.bounds().OffsetFromOrigin(); |
| 168 gfx::Rect bounds_in_screen(origin, bounds.size()); | 168 gfx::Rect bounds_in_screen(origin, bounds.size()); |
| 169 static_cast<WmWindowAura*>( | 169 ash::wm::GetDefaultParent(WmWindow::Get(context), WmWindow::Get(window), |
| 170 ash::wm::GetDefaultParent(WmWindowAura::Get(context), | 170 bounds_in_screen) |
| 171 WmWindowAura::Get(window), bounds_in_screen)) | |
| 172 ->aura_window() | 171 ->aura_window() |
| 173 ->AddChild(window); | 172 ->AddChild(window); |
| 174 } | 173 } |
| 175 return window; | 174 return window; |
| 176 } | 175 } |
| 177 | 176 |
| 178 ash::WmWindowAura* RootWindowController::GetWindowByShellWindowId(int id) { | 177 WmWindow* RootWindowController::GetWindowByShellWindowId(int id) { |
| 179 return static_cast<WmWindowAura*>( | 178 return WmWindow::Get(root())->GetChildByShellWindowId(id); |
| 180 WmWindowAura::Get(root())->GetChildByShellWindowId(id)); | |
| 181 } | 179 } |
| 182 | 180 |
| 183 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) { | 181 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) { |
| 184 gfx::Rect old_work_area = display_.work_area(); | 182 gfx::Rect old_work_area = display_.work_area(); |
| 185 display_.UpdateWorkAreaFromInsets(insets); | 183 display_.UpdateWorkAreaFromInsets(insets); |
| 186 | 184 |
| 187 if (old_work_area == display_.work_area()) | 185 if (old_work_area == display_.work_area()) |
| 188 return; | 186 return; |
| 189 | 187 |
| 190 window_manager_->screen()->display_list().UpdateDisplay(display_); | 188 window_manager_->screen()->display_list().UpdateDisplay(display_); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } else { | 233 } else { |
| 236 width = root()->bounds().width() - 240; | 234 width = root()->bounds().width() - 240; |
| 237 height = root()->bounds().height() - 240; | 235 height = root()->bounds().height() - 240; |
| 238 } | 236 } |
| 239 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40, | 237 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40, |
| 240 width, height); | 238 width, height); |
| 241 } | 239 } |
| 242 | 240 |
| 243 } // namespace mus | 241 } // namespace mus |
| 244 } // namespace ash | 242 } // namespace ash |
| OLD | NEW |