| 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> | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 54       root_(root), | 54       root_(root), | 
| 55       window_count_(0), | 55       window_count_(0), | 
| 56       display_(display), | 56       display_(display), | 
| 57       wm_root_window_controller_( | 57       wm_root_window_controller_( | 
| 58           base::MakeUnique<WmRootWindowControllerMus>(window_manager_->shell(), | 58           base::MakeUnique<WmRootWindowControllerMus>(window_manager_->shell(), | 
| 59                                                       this)) { | 59                                                       this)) { | 
| 60   wm_root_window_controller_->CreateContainers(); | 60   wm_root_window_controller_->CreateContainers(); | 
| 61   wm_root_window_controller_->CreateLayoutManagers(); | 61   wm_root_window_controller_->CreateLayoutManagers(); | 
| 62   CreateLayoutManagers(); | 62   CreateLayoutManagers(); | 
| 63 | 63 | 
|  | 64   root_->SetIsContainer(); | 
| 64   disconnected_app_handler_.reset(new DisconnectedAppHandler(root)); | 65   disconnected_app_handler_.reset(new DisconnectedAppHandler(root)); | 
| 65 | 66 | 
| 66   // Force a layout of the root, and its children, RootWindowLayout handles | 67   // Force a layout of the root, and its children, RootWindowLayout handles | 
| 67   // both. | 68   // both. | 
| 68   wm_root_window_controller_->root_window_layout_manager()->OnWindowResized(); | 69   wm_root_window_controller_->root_window_layout_manager()->OnWindowResized(); | 
| 69 | 70 | 
| 70   for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { | 71   for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { | 
| 71     window_manager_->window_manager_client()->AddActivationParent( | 72     window_manager_->window_manager_client()->AddActivationParent( | 
| 72         GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window()); | 73         GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window()); | 
| 73   } | 74   } | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 93   // TODO(sky): panels need a different frame, http:://crbug.com/614362. | 94   // TODO(sky): panels need a different frame, http:://crbug.com/614362. | 
| 94   const bool provide_non_client_frame = | 95   const bool provide_non_client_frame = | 
| 95       GetWindowType(*properties) == ui::mojom::WindowType::WINDOW || | 96       GetWindowType(*properties) == ui::mojom::WindowType::WINDOW || | 
| 96       GetWindowType(*properties) == ui::mojom::WindowType::PANEL; | 97       GetWindowType(*properties) == ui::mojom::WindowType::PANEL; | 
| 97   if (provide_non_client_frame) | 98   if (provide_non_client_frame) | 
| 98     (*properties)[ui::mojom::kWaitForUnderlay_Property].clear(); | 99     (*properties)[ui::mojom::kWaitForUnderlay_Property].clear(); | 
| 99 | 100 | 
| 100   // TODO(sky): constrain and validate properties before passing to server. | 101   // TODO(sky): constrain and validate properties before passing to server. | 
| 101   ui::Window* window = root_->window_tree()->NewWindow(properties); | 102   ui::Window* window = root_->window_tree()->NewWindow(properties); | 
| 102   window->SetBounds(CalculateDefaultBounds(window)); | 103   window->SetBounds(CalculateDefaultBounds(window)); | 
|  | 104   // window->SetIsContainer(); | 
| 103 | 105 | 
| 104   ui::Window* container_window = nullptr; | 106   ui::Window* container_window = nullptr; | 
| 105   mojom::Container container; | 107   mojom::Container container; | 
| 106   if (GetRequestedContainer(window, &container)) { | 108   if (GetRequestedContainer(window, &container)) { | 
| 107     container_window = GetWindowForContainer(container); | 109     container_window = GetWindowForContainer(container); | 
| 108   } else { | 110   } else { | 
| 109     // TODO(sky): window->bounds() isn't quite right. | 111     // TODO(sky): window->bounds() isn't quite right. | 
| 110     container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent( | 112     container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent( | 
| 111         WmWindowMus::Get(root_), WmWindowMus::Get(window), window->bounds())); | 113         WmWindowMus::Get(root_), WmWindowMus::Get(window), window->bounds())); | 
| 112   } | 114   } | 
|  | 115   container_window->SetIsContainer(); | 
| 113   DCHECK(WmWindowMus::Get(container_window)->IsContainer()); | 116   DCHECK(WmWindowMus::Get(container_window)->IsContainer()); | 
| 114 | 117 | 
| 115   if (provide_non_client_frame) { | 118   if (provide_non_client_frame) { | 
| 116     NonClientFrameController::Create(container_window, window, | 119     NonClientFrameController::Create(container_window, window, | 
| 117                                      window_manager_->window_manager_client()); | 120                                      window_manager_->window_manager_client()); | 
| 118   } else { | 121   } else { | 
| 119     container_window->AddChild(window); | 122     container_window->AddChild(window); | 
| 120   } | 123   } | 
| 121 | 124 | 
| 122   window_count_++; | 125   window_count_++; | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 177       GetWindowByShellWindowId(kShellWindowId_DefaultContainer); | 180       GetWindowByShellWindowId(kShellWindowId_DefaultContainer); | 
| 178   // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's a | 181   // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's a | 
| 179   // wm::LayoutManager), so it can't be in |layout_managers_|. | 182   // wm::LayoutManager), so it can't be in |layout_managers_|. | 
| 180   workspace_layout_manager_ = new WorkspaceLayoutManager(default_container); | 183   workspace_layout_manager_ = new WorkspaceLayoutManager(default_container); | 
| 181   default_container->SetLayoutManager( | 184   default_container->SetLayoutManager( | 
| 182       base::WrapUnique(workspace_layout_manager_)); | 185       base::WrapUnique(workspace_layout_manager_)); | 
| 183 } | 186 } | 
| 184 | 187 | 
| 185 }  // namespace mus | 188 }  // namespace mus | 
| 186 }  // namespace ash | 189 }  // namespace ash | 
| OLD | NEW | 
|---|