Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: ash/mus/root_window_controller.cc

Issue 2230723003: mash: Show status area widget, attempt 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: placeholder widget Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/root_window_controller_common.h" 16 #include "ash/common/root_window_controller_common.h"
17 #include "ash/common/session/session_state_delegate.h"
17 #include "ash/common/shell_window_ids.h" 18 #include "ash/common/shell_window_ids.h"
19 #include "ash/common/system/status_area_widget.h"
18 #include "ash/common/wm/always_on_top_controller.h" 20 #include "ash/common/wm/always_on_top_controller.h"
19 #include "ash/common/wm/container_finder.h" 21 #include "ash/common/wm/container_finder.h"
20 #include "ash/common/wm/dock/docked_window_layout_manager.h" 22 #include "ash/common/wm/dock/docked_window_layout_manager.h"
21 #include "ash/common/wm/panels/panel_layout_manager.h" 23 #include "ash/common/wm/panels/panel_layout_manager.h"
22 #include "ash/common/wm/root_window_layout_manager.h" 24 #include "ash/common/wm/root_window_layout_manager.h"
23 #include "ash/common/wm/workspace/workspace_layout_manager.h" 25 #include "ash/common/wm/workspace/workspace_layout_manager.h"
24 #include "ash/common/wm/workspace/workspace_layout_manager_delegate.h" 26 #include "ash/common/wm/workspace/workspace_layout_manager_delegate.h"
25 #include "ash/mus/bridge/wm_root_window_controller_mus.h" 27 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
26 #include "ash/mus/bridge/wm_shelf_mus.h" 28 #include "ash/mus/bridge/wm_shelf_mus.h"
27 #include "ash/mus/bridge/wm_shell_mus.h" 29 #include "ash/mus/bridge/wm_shell_mus.h"
28 #include "ash/mus/bridge/wm_window_mus.h" 30 #include "ash/mus/bridge/wm_window_mus.h"
29 #include "ash/mus/container_ids.h" 31 #include "ash/mus/container_ids.h"
30 #include "ash/mus/non_client_frame_controller.h" 32 #include "ash/mus/non_client_frame_controller.h"
31 #include "ash/mus/property_util.h" 33 #include "ash/mus/property_util.h"
32 #include "ash/mus/screenlock_layout.h" 34 #include "ash/mus/screenlock_layout.h"
33 #include "ash/mus/shelf_layout_manager.h" 35 #include "ash/mus/shelf_layout_manager.h"
34 #include "ash/mus/status_layout_manager.h"
35 #include "ash/mus/window_manager.h" 36 #include "ash/mus/window_manager.h"
36 #include "base/bind.h" 37 #include "base/bind.h"
37 #include "base/command_line.h" 38 #include "base/command_line.h"
38 #include "base/memory/ptr_util.h" 39 #include "base/memory/ptr_util.h"
39 #include "mojo/public/cpp/bindings/type_converter.h" 40 #include "mojo/public/cpp/bindings/type_converter.h"
40 #include "services/shell/public/cpp/connector.h" 41 #include "services/shell/public/cpp/connector.h"
41 #include "services/ui/common/switches.h" 42 #include "services/ui/common/switches.h"
42 #include "services/ui/common/util.h" 43 #include "services/ui/common/util.h"
43 #include "services/ui/public/cpp/property_type_converters.h" 44 #include "services/ui/public/cpp/property_type_converters.h"
44 #include "services/ui/public/cpp/window.h" 45 #include "services/ui/public/cpp/window.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 window_count_(0), 86 window_count_(0),
86 display_(display) { 87 display_(display) {
87 wm_root_window_controller_.reset( 88 wm_root_window_controller_.reset(
88 new WmRootWindowControllerMus(window_manager_->shell(), this)); 89 new WmRootWindowControllerMus(window_manager_->shell(), this));
89 90
90 root_window_controller_common_.reset( 91 root_window_controller_common_.reset(
91 new RootWindowControllerCommon(WmWindowMus::Get(root_))); 92 new RootWindowControllerCommon(WmWindowMus::Get(root_)));
92 root_window_controller_common_->CreateContainers(); 93 root_window_controller_common_->CreateContainers();
93 root_window_controller_common_->CreateLayoutManagers(); 94 root_window_controller_common_->CreateLayoutManagers();
94 CreateLayoutManagers(); 95 CreateLayoutManagers();
96 CreateStatusArea();
95 97
96 disconnected_app_handler_.reset(new DisconnectedAppHandler(root)); 98 disconnected_app_handler_.reset(new DisconnectedAppHandler(root));
97 99
98 // Force a layout of the root, and its children, RootWindowLayout handles 100 // Force a layout of the root, and its children, RootWindowLayout handles
99 // both. 101 // both.
100 root_window_controller_common_->root_window_layout()->OnWindowResized(); 102 root_window_controller_common_->root_window_layout()->OnWindowResized();
101 103
102 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { 104 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) {
103 window_manager_->window_manager_client()->AddActivationParent( 105 window_manager_->window_manager_client()->AddActivationParent(
104 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window()); 106 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); 214 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer);
213 layout_managers_[lock_screen_container->mus_window()].reset( 215 layout_managers_[lock_screen_container->mus_window()].reset(
214 new ScreenlockLayout(lock_screen_container->mus_window())); 216 new ScreenlockLayout(lock_screen_container->mus_window()));
215 217
216 WmWindowMus* shelf_container = 218 WmWindowMus* shelf_container =
217 GetWindowByShellWindowId(kShellWindowId_ShelfContainer); 219 GetWindowByShellWindowId(kShellWindowId_ShelfContainer);
218 ShelfLayoutManager* shelf_layout_manager = 220 ShelfLayoutManager* shelf_layout_manager =
219 new ShelfLayoutManager(shelf_container->mus_window(), this); 221 new ShelfLayoutManager(shelf_container->mus_window(), this);
220 layout_managers_[shelf_container->mus_window()].reset(shelf_layout_manager); 222 layout_managers_[shelf_container->mus_window()].reset(shelf_layout_manager);
221 223
222 wm_shelf_.reset(new WmShelfMus(shelf_layout_manager)); 224 wm_shelf_.reset(new WmShelfMus(wm_root_window_controller_.get()));
223
224 WmWindowMus* status_container =
225 GetWindowByShellWindowId(kShellWindowId_StatusContainer);
226 layout_managers_[status_container->mus_window()].reset(
227 new StatusLayoutManager(status_container->mus_window()));
228 225
229 WmWindowMus* default_container = 226 WmWindowMus* default_container =
230 GetWindowByShellWindowId(kShellWindowId_DefaultContainer); 227 GetWindowByShellWindowId(kShellWindowId_DefaultContainer);
231 // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's a 228 // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's a
232 // wm::LayoutManager), so it can't be in |layout_managers_|. 229 // wm::LayoutManager), so it can't be in |layout_managers_|.
233 std::unique_ptr<WorkspaceLayoutManagerDelegateImpl> 230 std::unique_ptr<WorkspaceLayoutManagerDelegateImpl>
234 workspace_layout_manager_delegate(new WorkspaceLayoutManagerDelegateImpl( 231 workspace_layout_manager_delegate(new WorkspaceLayoutManagerDelegateImpl(
235 wm_root_window_controller_.get())); 232 wm_root_window_controller_.get()));
236 workspace_layout_manager_ = new WorkspaceLayoutManager( 233 workspace_layout_manager_ = new WorkspaceLayoutManager(
237 default_container, std::move(workspace_layout_manager_delegate)); 234 default_container, std::move(workspace_layout_manager_delegate));
238 default_container->SetLayoutManager( 235 default_container->SetLayoutManager(
239 base::WrapUnique(workspace_layout_manager_)); 236 base::WrapUnique(workspace_layout_manager_));
240 237
241 WmWindowMus* docked_container = 238 WmWindowMus* docked_container =
242 GetWindowByShellWindowId(kShellWindowId_DockedContainer); 239 GetWindowByShellWindowId(kShellWindowId_DockedContainer);
243 docked_container->SetLayoutManager( 240 docked_container->SetLayoutManager(
244 base::WrapUnique(new DockedWindowLayoutManager(docked_container))); 241 base::WrapUnique(new DockedWindowLayoutManager(docked_container)));
245 242
246 WmWindowMus* panel_container = 243 WmWindowMus* panel_container =
247 GetWindowByShellWindowId(kShellWindowId_PanelContainer); 244 GetWindowByShellWindowId(kShellWindowId_PanelContainer);
248 panel_container->SetLayoutManager( 245 panel_container->SetLayoutManager(
249 base::WrapUnique(new PanelLayoutManager(panel_container))); 246 base::WrapUnique(new PanelLayoutManager(panel_container)));
250 } 247 }
251 248
249 void RootWindowController::CreateStatusArea() {
250 WmWindowMus* status_container =
251 GetWindowByShellWindowId(kShellWindowId_StatusContainer);
252 // Owned by native widget.
253 StatusAreaWidget* status_area_widget =
254 new StatusAreaWidget(status_container, wm_shelf_.get());
255 status_area_widget->CreateTrayViews();
256 // TODO(jamescook): Remove this when ash::StatusAreaLayoutManager and
257 // ash::ShelfLayoutManager are working in mash. http://crbug.com/621112
258 status_area_widget->SetBounds(gfx::Rect(845, 720, 120, 40));
259 if (WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted())
260 status_area_widget->Show();
261 }
262
252 } // namespace mus 263 } // namespace mus
253 } // namespace ash 264 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698