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

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: rebase 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
« no previous file with comments | « ash/mus/root_window_controller.h ('k') | ash/mus/status_layout_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/mus/bridge/wm_root_window_controller_mus.h" 26 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
25 #include "ash/mus/bridge/wm_shelf_mus.h" 27 #include "ash/mus/bridge/wm_shelf_mus.h"
26 #include "ash/mus/bridge/wm_shell_mus.h" 28 #include "ash/mus/bridge/wm_shell_mus.h"
27 #include "ash/mus/bridge/wm_window_mus.h" 29 #include "ash/mus/bridge/wm_window_mus.h"
28 #include "ash/mus/container_ids.h" 30 #include "ash/mus/container_ids.h"
29 #include "ash/mus/non_client_frame_controller.h" 31 #include "ash/mus/non_client_frame_controller.h"
30 #include "ash/mus/property_util.h" 32 #include "ash/mus/property_util.h"
31 #include "ash/mus/screenlock_layout.h" 33 #include "ash/mus/screenlock_layout.h"
32 #include "ash/mus/shelf_layout_manager.h" 34 #include "ash/mus/shelf_layout_manager.h"
33 #include "ash/mus/status_layout_manager.h"
34 #include "ash/mus/window_manager.h" 35 #include "ash/mus/window_manager.h"
35 #include "base/bind.h" 36 #include "base/bind.h"
36 #include "base/command_line.h" 37 #include "base/command_line.h"
37 #include "base/memory/ptr_util.h" 38 #include "base/memory/ptr_util.h"
38 #include "mojo/public/cpp/bindings/type_converter.h" 39 #include "mojo/public/cpp/bindings/type_converter.h"
39 #include "services/shell/public/cpp/connector.h" 40 #include "services/shell/public/cpp/connector.h"
40 #include "services/ui/common/switches.h" 41 #include "services/ui/common/switches.h"
41 #include "services/ui/common/util.h" 42 #include "services/ui/common/util.h"
42 #include "services/ui/public/cpp/property_type_converters.h" 43 #include "services/ui/public/cpp/property_type_converters.h"
43 #include "services/ui/public/cpp/window.h" 44 #include "services/ui/public/cpp/window.h"
(...skipping 14 matching lines...) Expand all
58 window_count_(0), 59 window_count_(0),
59 display_(display) { 60 display_(display) {
60 wm_root_window_controller_.reset( 61 wm_root_window_controller_.reset(
61 new WmRootWindowControllerMus(window_manager_->shell(), this)); 62 new WmRootWindowControllerMus(window_manager_->shell(), this));
62 63
63 root_window_controller_common_.reset( 64 root_window_controller_common_.reset(
64 new RootWindowControllerCommon(WmWindowMus::Get(root_))); 65 new RootWindowControllerCommon(WmWindowMus::Get(root_)));
65 root_window_controller_common_->CreateContainers(); 66 root_window_controller_common_->CreateContainers();
66 root_window_controller_common_->CreateLayoutManagers(); 67 root_window_controller_common_->CreateLayoutManagers();
67 CreateLayoutManagers(); 68 CreateLayoutManagers();
69 CreateStatusArea();
68 70
69 disconnected_app_handler_.reset(new DisconnectedAppHandler(root)); 71 disconnected_app_handler_.reset(new DisconnectedAppHandler(root));
70 72
71 // Force a layout of the root, and its children, RootWindowLayout handles 73 // Force a layout of the root, and its children, RootWindowLayout handles
72 // both. 74 // both.
73 root_window_controller_common_->root_window_layout()->OnWindowResized(); 75 root_window_controller_common_->root_window_layout()->OnWindowResized();
74 76
75 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { 77 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) {
76 window_manager_->window_manager_client()->AddActivationParent( 78 window_manager_->window_manager_client()->AddActivationParent(
77 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window()); 79 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); 187 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer);
186 layout_managers_[lock_screen_container->mus_window()].reset( 188 layout_managers_[lock_screen_container->mus_window()].reset(
187 new ScreenlockLayout(lock_screen_container->mus_window())); 189 new ScreenlockLayout(lock_screen_container->mus_window()));
188 190
189 WmWindowMus* shelf_container = 191 WmWindowMus* shelf_container =
190 GetWindowByShellWindowId(kShellWindowId_ShelfContainer); 192 GetWindowByShellWindowId(kShellWindowId_ShelfContainer);
191 ShelfLayoutManager* shelf_layout_manager = 193 ShelfLayoutManager* shelf_layout_manager =
192 new ShelfLayoutManager(shelf_container->mus_window(), this); 194 new ShelfLayoutManager(shelf_container->mus_window(), this);
193 layout_managers_[shelf_container->mus_window()].reset(shelf_layout_manager); 195 layout_managers_[shelf_container->mus_window()].reset(shelf_layout_manager);
194 196
195 wm_shelf_.reset(new WmShelfMus(shelf_layout_manager)); 197 wm_shelf_.reset(new WmShelfMus(wm_root_window_controller_.get()));
196
197 WmWindowMus* status_container =
198 GetWindowByShellWindowId(kShellWindowId_StatusContainer);
199 layout_managers_[status_container->mus_window()].reset(
200 new StatusLayoutManager(status_container->mus_window()));
201 198
202 WmWindowMus* default_container = 199 WmWindowMus* default_container =
203 GetWindowByShellWindowId(kShellWindowId_DefaultContainer); 200 GetWindowByShellWindowId(kShellWindowId_DefaultContainer);
204 // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's a 201 // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's a
205 // wm::LayoutManager), so it can't be in |layout_managers_|. 202 // wm::LayoutManager), so it can't be in |layout_managers_|.
206 workspace_layout_manager_ = new WorkspaceLayoutManager(default_container); 203 workspace_layout_manager_ = new WorkspaceLayoutManager(default_container);
207 default_container->SetLayoutManager( 204 default_container->SetLayoutManager(
208 base::WrapUnique(workspace_layout_manager_)); 205 base::WrapUnique(workspace_layout_manager_));
209 206
210 WmWindowMus* docked_container = 207 WmWindowMus* docked_container =
211 GetWindowByShellWindowId(kShellWindowId_DockedContainer); 208 GetWindowByShellWindowId(kShellWindowId_DockedContainer);
212 docked_container->SetLayoutManager( 209 docked_container->SetLayoutManager(
213 base::WrapUnique(new DockedWindowLayoutManager(docked_container))); 210 base::WrapUnique(new DockedWindowLayoutManager(docked_container)));
214 211
215 WmWindowMus* panel_container = 212 WmWindowMus* panel_container =
216 GetWindowByShellWindowId(kShellWindowId_PanelContainer); 213 GetWindowByShellWindowId(kShellWindowId_PanelContainer);
217 panel_container->SetLayoutManager( 214 panel_container->SetLayoutManager(
218 base::WrapUnique(new PanelLayoutManager(panel_container))); 215 base::WrapUnique(new PanelLayoutManager(panel_container)));
219 } 216 }
220 217
218 void RootWindowController::CreateStatusArea() {
219 WmWindowMus* status_container =
220 GetWindowByShellWindowId(kShellWindowId_StatusContainer);
221 // Owned by native widget.
222 StatusAreaWidget* status_area_widget =
223 new StatusAreaWidget(status_container, wm_shelf_.get());
224 status_area_widget->CreateTrayViews();
225 // TODO(jamescook): Remove this when ash::StatusAreaLayoutManager and
226 // ash::ShelfLayoutManager are working in mash. http://crbug.com/621112
227 status_area_widget->SetBounds(gfx::Rect(845, 720, 120, 40));
228 if (WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted())
229 status_area_widget->Show();
230 }
231
221 } // namespace mus 232 } // namespace mus
222 } // namespace ash 233 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/root_window_controller.h ('k') | ash/mus/status_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698