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

Side by Side Diff: ash/common/wm_shell.cc

Issue 2381753002: Use mojo SystemTray interfaces for both mash and classic ash (Closed)
Patch Set: Restructure based on feedback Created 4 years, 2 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/common/wm_shell.h" 5 #include "ash/common/wm_shell.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/accelerators/accelerator_controller.h" 9 #include "ash/common/accelerators/accelerator_controller.h"
10 #include "ash/common/accelerators/ash_focus_manager_factory.h" 10 #include "ash/common/accelerators/ash_focus_manager_factory.h"
11 #include "ash/common/accessibility_delegate.h" 11 #include "ash/common/accessibility_delegate.h"
12 #include "ash/common/focus_cycler.h" 12 #include "ash/common/focus_cycler.h"
13 #include "ash/common/keyboard/keyboard_ui.h" 13 #include "ash/common/keyboard/keyboard_ui.h"
14 #include "ash/common/new_window_delegate.h" 14 #include "ash/common/new_window_delegate.h"
15 #include "ash/common/palette_delegate.h" 15 #include "ash/common/palette_delegate.h"
16 #include "ash/common/session/session_state_delegate.h" 16 #include "ash/common/session/session_state_delegate.h"
17 #include "ash/common/shelf/app_list_shelf_item_delegate.h" 17 #include "ash/common/shelf/app_list_shelf_item_delegate.h"
18 #include "ash/common/shelf/shelf_delegate.h" 18 #include "ash/common/shelf/shelf_delegate.h"
19 #include "ash/common/shelf/shelf_model.h" 19 #include "ash/common/shelf/shelf_model.h"
20 #include "ash/common/shelf/shelf_window_watcher.h" 20 #include "ash/common/shelf/shelf_window_watcher.h"
21 #include "ash/common/shell_delegate.h" 21 #include "ash/common/shell_delegate.h"
22 #include "ash/common/shell_window_ids.h" 22 #include "ash/common/shell_window_ids.h"
23 #include "ash/common/system/brightness_control_delegate.h" 23 #include "ash/common/system/brightness_control_delegate.h"
24 #include "ash/common/system/keyboard_brightness_control_delegate.h" 24 #include "ash/common/system/keyboard_brightness_control_delegate.h"
25 #include "ash/common/system/toast/toast_manager.h" 25 #include "ash/common/system/toast/toast_manager.h"
26 #include "ash/common/system/tray/system_tray_controller.h"
26 #include "ash/common/system/tray/system_tray_delegate.h" 27 #include "ash/common/system/tray/system_tray_delegate.h"
27 #include "ash/common/system/tray/system_tray_notifier.h" 28 #include "ash/common/system/tray/system_tray_notifier.h"
28 #include "ash/common/wallpaper/wallpaper_controller.h" 29 #include "ash/common/wallpaper/wallpaper_controller.h"
29 #include "ash/common/wallpaper/wallpaper_delegate.h" 30 #include "ash/common/wallpaper/wallpaper_delegate.h"
30 #include "ash/common/wm/immersive_context_ash.h" 31 #include "ash/common/wm/immersive_context_ash.h"
31 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 32 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
32 #include "ash/common/wm/mru_window_tracker.h" 33 #include "ash/common/wm/mru_window_tracker.h"
33 #include "ash/common/wm/overview/window_selector_controller.h" 34 #include "ash/common/wm/overview/window_selector_controller.h"
34 #include "ash/common/wm/root_window_finder.h" 35 #include "ash/common/wm/root_window_finder.h"
35 #include "ash/common/wm/system_modal_container_layout_manager.h" 36 #include "ash/common/wm/system_modal_container_layout_manager.h"
(...skipping 21 matching lines...) Expand all
57 // static 58 // static
58 void WmShell::Set(WmShell* instance) { 59 void WmShell::Set(WmShell* instance) {
59 instance_ = instance; 60 instance_ = instance;
60 } 61 }
61 62
62 // static 63 // static
63 WmShell* WmShell::Get() { 64 WmShell* WmShell::Get() {
64 return instance_; 65 return instance_;
65 } 66 }
66 67
67 void WmShell::Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool) { 68 void WmShell::Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool,
69 shell::Connector* connector) {
68 blocking_pool_ = pool; 70 blocking_pool_ = pool;
69 71
70 // Some delegates access WmShell during their construction. Create them here 72 // Some delegates access WmShell during their construction. Create them here
71 // instead of the WmShell constructor. 73 // instead of the WmShell constructor.
72 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); 74 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate());
73 media_delegate_.reset(delegate_->CreateMediaDelegate()); 75 media_delegate_.reset(delegate_->CreateMediaDelegate());
74 palette_delegate_ = delegate_->CreatePaletteDelegate(); 76 palette_delegate_ = delegate_->CreatePaletteDelegate();
75 toast_manager_.reset(new ToastManager); 77 toast_manager_.reset(new ToastManager);
76 78
77 // Create the app list item in the shelf data model. 79 // Create the app list item in the shelf data model.
78 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get()); 80 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get());
79 81
80 // Install the custom factory early on so that views::FocusManagers for Tray, 82 // Install the custom factory early on so that views::FocusManagers for Tray,
81 // Shelf, and WallPaper could be created by the factory. 83 // Shelf, and WallPaper could be created by the factory.
82 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 84 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
83 85
84 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); 86 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate());
85 87
86 wallpaper_controller_.reset(new WallpaperController(blocking_pool_)); 88 wallpaper_controller_.reset(new WallpaperController(blocking_pool_));
89 system_tray_controller_.reset(new SystemTrayController(connector));
87 } 90 }
88 91
89 void WmShell::Shutdown() { 92 void WmShell::Shutdown() {
90 // These members access WmShell in their destructors. 93 // These members access WmShell in their destructors.
91 wallpaper_controller_.reset(); 94 wallpaper_controller_.reset();
92 accessibility_delegate_.reset(); 95 accessibility_delegate_.reset();
93 96
94 // ShelfWindowWatcher has window observers and a pointer to the shelf model. 97 // ShelfWindowWatcher has window observers and a pointer to the shelf model.
95 shelf_window_watcher_.reset(); 98 shelf_window_watcher_.reset();
96 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC 99 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 void WmShell::DeleteToastManager() { 352 void WmShell::DeleteToastManager() {
350 toast_manager_.reset(); 353 toast_manager_.reset();
351 } 354 }
352 355
353 void WmShell::SetAcceleratorController( 356 void WmShell::SetAcceleratorController(
354 std::unique_ptr<AcceleratorController> accelerator_controller) { 357 std::unique_ptr<AcceleratorController> accelerator_controller) {
355 accelerator_controller_ = std::move(accelerator_controller); 358 accelerator_controller_ = std::move(accelerator_controller);
356 } 359 }
357 360
358 } // namespace ash 361 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698