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/bridge/wm_shelf_mus.h" | 5 #include "ash/mus/bridge/wm_shelf_mus.h" |
6 | 6 |
7 #include "ash/common/shelf/shelf.h" | |
8 #include "ash/common/shelf/shelf_delegate.h" | |
9 #include "ash/common/shelf/shelf_widget.h" | 7 #include "ash/common/shelf/shelf_widget.h" |
10 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
11 #include "ash/common/wm_root_window_controller.h" | 9 #include "ash/common/wm_root_window_controller.h" |
12 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
13 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
14 | 12 |
15 namespace ash { | 13 namespace ash { |
16 namespace mus { | 14 namespace mus { |
17 | 15 |
18 WmShelfMus::WmShelfMus(WmRootWindowController* root_window_controller) { | 16 WmShelfMus::WmShelfMus(WmRootWindowController* root_window_controller) { |
19 DCHECK(root_window_controller); | 17 DCHECK(root_window_controller); |
20 WmShell::Get()->CreateShelfDelegate(); | 18 WmShell::Get()->CreateShelfDelegate(); |
21 WmWindow* root = root_window_controller->GetWindow(); | 19 WmWindow* root = root_window_controller->GetWindow(); |
22 shelf_widget_.reset(new ShelfWidget( | 20 shelf_widget_.reset(new ShelfWidget( |
23 root->GetChildByShellWindowId(kShellWindowId_ShelfContainer), | 21 root->GetChildByShellWindowId(kShellWindowId_ShelfContainer), |
24 root->GetChildByShellWindowId(kShellWindowId_StatusContainer), this)); | 22 root->GetChildByShellWindowId(kShellWindowId_StatusContainer), this)); |
25 shelf_.reset( | 23 InitializeShelf(); |
26 new Shelf(this, shelf_widget_->CreateShelfView(), shelf_widget_.get())); | |
27 shelf_widget_->set_shelf(shelf_.get()); | |
28 // Must be initialized before the delegate is notified because the delegate | |
29 // may try to access the WmShelf. | |
30 SetShelf(shelf_.get()); | |
31 WmShell::Get()->shelf_delegate()->OnShelfCreated(this); | |
32 WmShell::Get()->NotifyShelfCreatedForRootWindow(root); | 24 WmShell::Get()->NotifyShelfCreatedForRootWindow(root); |
33 shelf_widget_->PostCreateShelf(); | 25 shelf_widget_->PostCreateShelf(); |
34 } | 26 } |
35 | 27 |
36 WmShelfMus::~WmShelfMus() { | 28 WmShelfMus::~WmShelfMus() { |
37 shelf_widget_.reset(); | 29 shelf_widget_.reset(); |
38 WmShelf::ClearShelf(); | 30 ShutdownShelf(); |
39 } | 31 } |
40 | 32 |
41 void WmShelfMus::WillDeleteShelfLayoutManager() { | 33 void WmShelfMus::WillDeleteShelfLayoutManager() { |
42 shelf_widget_->Shutdown(); | 34 shelf_widget_->Shutdown(); |
43 WmShelf::WillDeleteShelfLayoutManager(); | 35 WmShelf::WillDeleteShelfLayoutManager(); |
44 } | 36 } |
45 | 37 |
46 } // namespace mus | 38 } // namespace mus |
47 } // namespace ash | 39 } // namespace ash |
OLD | NEW |