| 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 "mash/wm/root_window_controller.h" | 5 #include "mash/wm/root_window_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" |
| 10 #include "components/mus/common/event_matcher_util.h" | 11 #include "components/mus/common/event_matcher_util.h" |
| 12 #include "components/mus/common/switches.h" |
| 11 #include "components/mus/common/util.h" | 13 #include "components/mus/common/util.h" |
| 12 #include "components/mus/public/cpp/window.h" | 14 #include "components/mus/public/cpp/window.h" |
| 13 #include "components/mus/public/cpp/window_tree_connection.h" | 15 #include "components/mus/public/cpp/window_tree_connection.h" |
| 14 #include "components/mus/public/cpp/window_tree_host_factory.h" | 16 #include "components/mus/public/cpp/window_tree_host_factory.h" |
| 15 #include "mash/session/public/interfaces/session.mojom.h" | 17 #include "mash/session/public/interfaces/session.mojom.h" |
| 16 #include "mash/wm/background_layout.h" | 18 #include "mash/wm/background_layout.h" |
| 17 #include "mash/wm/container_ids.h" | 19 #include "mash/wm/container_ids.h" |
| 18 #include "mash/wm/fill_layout.h" | 20 #include "mash/wm/fill_layout.h" |
| 19 #include "mash/wm/screenlock_layout.h" | 21 #include "mash/wm/screenlock_layout.h" |
| 20 #include "mash/wm/shadow_controller.h" | 22 #include "mash/wm/shadow_controller.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 171 } |
| 170 | 172 |
| 171 void RootWindowController::CreateContainer( | 173 void RootWindowController::CreateContainer( |
| 172 mash::wm::mojom::Container container, | 174 mash::wm::mojom::Container container, |
| 173 mash::wm::mojom::Container parent_container) { | 175 mash::wm::mojom::Container parent_container) { |
| 174 mus::Window* window = root_->connection()->NewWindow(); | 176 mus::Window* window = root_->connection()->NewWindow(); |
| 175 window->set_local_id(ContainerToLocalId(container)); | 177 window->set_local_id(ContainerToLocalId(container)); |
| 176 layout_managers_[window].reset(new FillLayout(window)); | 178 layout_managers_[window].reset(new FillLayout(window)); |
| 177 | 179 |
| 178 // User private windows are hidden by default until the window manager learns | 180 // User private windows are hidden by default until the window manager learns |
| 179 // the lock state, so their contents are never accidentally revealed. | 181 // the lock state, so their contents are never accidentally revealed. Tests, |
| 180 window->SetVisible(container != mojom::Container::USER_PRIVATE); | 182 // however, usually assume the screen is unlocked. |
| 183 const bool is_test = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 184 mus::switches::kUseTestConfig); |
| 185 window->SetVisible(container != mojom::Container::USER_PRIVATE || is_test); |
| 186 |
| 181 mus::Window* parent = | 187 mus::Window* parent = |
| 182 root_->GetChildByLocalId(ContainerToLocalId(parent_container)); | 188 root_->GetChildByLocalId(ContainerToLocalId(parent_container)); |
| 183 parent->AddChild(window); | 189 parent->AddChild(window); |
| 184 } | 190 } |
| 185 | 191 |
| 186 void RootWindowController::CreateContainers() { | 192 void RootWindowController::CreateContainers() { |
| 187 CreateContainer(mojom::Container::ALL_USER_BACKGROUND, | 193 CreateContainer(mojom::Container::ALL_USER_BACKGROUND, |
| 188 mojom::Container::ROOT); | 194 mojom::Container::ROOT); |
| 189 CreateContainer(mojom::Container::USER, mojom::Container::ROOT); | 195 CreateContainer(mojom::Container::USER, mojom::Container::ROOT); |
| 190 CreateContainer(mojom::Container::USER_BACKGROUND, mojom::Container::USER); | 196 CreateContainer(mojom::Container::USER_BACKGROUND, mojom::Container::USER); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 layout_managers_[status].reset(new StatusLayoutManager(status)); | 240 layout_managers_[status].reset(new StatusLayoutManager(status)); |
| 235 | 241 |
| 236 mus::Window* user_private_windows = | 242 mus::Window* user_private_windows = |
| 237 GetWindowForContainer(mojom::Container::USER_PRIVATE_WINDOWS); | 243 GetWindowForContainer(mojom::Container::USER_PRIVATE_WINDOWS); |
| 238 layout_managers_[user_private_windows].reset( | 244 layout_managers_[user_private_windows].reset( |
| 239 new WindowLayout(user_private_windows)); | 245 new WindowLayout(user_private_windows)); |
| 240 } | 246 } |
| 241 | 247 |
| 242 } // namespace wm | 248 } // namespace wm |
| 243 } // namespace mash | 249 } // namespace mash |
| OLD | NEW |