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

Side by Side Diff: ash/aura/wm_root_window_controller_aura.cc

Issue 2297893002: Merges RootWindowControllerCommon into WmRootWindowController (Closed)
Patch Set: feedback Created 4 years, 3 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/aura/wm_root_window_controller_aura.h ('k') | ash/common/root_window_controller_common.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/aura/wm_root_window_controller_aura.h" 5 #include "ash/aura/wm_root_window_controller_aura.h"
6 6
7 #include "ash/aura/wm_shelf_aura.h" 7 #include "ash/aura/wm_shelf_aura.h"
8 #include "ash/aura/wm_shell_aura.h" 8 #include "ash/aura/wm_shell_aura.h"
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/shelf/shelf.h" 10 #include "ash/common/shelf/shelf.h"
11 #include "ash/common/shelf/shelf_widget.h" 11 #include "ash/common/shelf/shelf_widget.h"
12 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h"
13 #include "ash/common/wm/workspace_controller.h"
14 #include "ash/common/wm_root_window_controller_observer.h" 12 #include "ash/common/wm_root_window_controller_observer.h"
15 #include "ash/display/window_tree_host_manager.h" 13 #include "ash/display/window_tree_host_manager.h"
16 #include "ash/root_window_controller.h" 14 #include "ash/root_window_controller.h"
17 #include "ash/shell.h" 15 #include "ash/shell.h"
18 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
19 #include "ui/aura/window_event_dispatcher.h" 17 #include "ui/aura/window_event_dispatcher.h"
20 #include "ui/aura/window_property.h" 18 #include "ui/aura/window_property.h"
21 #include "ui/aura/window_tree_host.h" 19 #include "ui/aura/window_tree_host.h"
22 #include "ui/display/screen.h" 20 #include "ui/display/screen.h"
23 #include "ui/events/event_targeter.h" 21 #include "ui/events/event_targeter.h"
24 #include "ui/events/event_utils.h" 22 #include "ui/events/event_utils.h"
25 23
26 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmRootWindowControllerAura*); 24 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmRootWindowControllerAura*);
27 25
28 namespace ash { 26 namespace ash {
29 27
30 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings. 28 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings.
31 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmRootWindowControllerAura, 29 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmRootWindowControllerAura,
32 kWmRootWindowControllerKey, 30 kWmRootWindowControllerKey,
33 nullptr); 31 nullptr);
34 32
35 WmRootWindowControllerAura::WmRootWindowControllerAura( 33 WmRootWindowControllerAura::WmRootWindowControllerAura(
36 RootWindowController* root_window_controller) 34 RootWindowController* root_window_controller)
37 : root_window_controller_(root_window_controller) { 35 : WmRootWindowController(
36 WmWindowAura::Get(root_window_controller->GetRootWindow())),
37 root_window_controller_(root_window_controller) {
38 root_window_controller_->GetRootWindow()->SetProperty( 38 root_window_controller_->GetRootWindow()->SetProperty(
39 kWmRootWindowControllerKey, this); 39 kWmRootWindowControllerKey, this);
40 WmShell::Get()->AddShellObserver(this); 40 WmShell::Get()->AddShellObserver(this);
41 display::Screen::GetScreen()->AddObserver(this); 41 display::Screen::GetScreen()->AddObserver(this);
42 } 42 }
43 43
44 WmRootWindowControllerAura::~WmRootWindowControllerAura() { 44 WmRootWindowControllerAura::~WmRootWindowControllerAura() {
45 WmShell::Get()->RemoveShellObserver(this); 45 WmShell::Get()->RemoveShellObserver(this);
46 display::Screen::GetScreen()->RemoveObserver(this); 46 display::Screen::GetScreen()->RemoveObserver(this);
47 } 47 }
(...skipping 20 matching lines...) Expand all
68 } 68 }
69 69
70 bool WmRootWindowControllerAura::HasShelf() { 70 bool WmRootWindowControllerAura::HasShelf() {
71 return root_window_controller_->shelf_widget() != nullptr; 71 return root_window_controller_->shelf_widget() != nullptr;
72 } 72 }
73 73
74 WmShell* WmRootWindowControllerAura::GetShell() { 74 WmShell* WmRootWindowControllerAura::GetShell() {
75 return WmShell::Get(); 75 return WmShell::Get();
76 } 76 }
77 77
78 wm::WorkspaceWindowState WmRootWindowControllerAura::GetWorkspaceWindowState() {
79 if (!root_window_controller_->workspace_controller())
80 return wm::WORKSPACE_WINDOW_STATE_DEFAULT;
81 return root_window_controller_->workspace_controller()->GetWindowState();
82 }
83
84 void WmRootWindowControllerAura::SetMaximizeBackdropDelegate(
85 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) {
86 root_window_controller_->workspace_controller()->SetMaximizeBackdropDelegate(
87 std::move(delegate));
88 }
89
90 AlwaysOnTopController* WmRootWindowControllerAura::GetAlwaysOnTopController() { 78 AlwaysOnTopController* WmRootWindowControllerAura::GetAlwaysOnTopController() {
91 return root_window_controller_->always_on_top_controller(); 79 return root_window_controller_->always_on_top_controller();
92 } 80 }
93 81
94 WmShelf* WmRootWindowControllerAura::GetShelf() { 82 WmShelf* WmRootWindowControllerAura::GetShelf() {
95 return root_window_controller_->wm_shelf_aura(); 83 return root_window_controller_->wm_shelf_aura();
96 } 84 }
97 85
98 WmWindow* WmRootWindowControllerAura::GetWindow() { 86 WmWindow* WmRootWindowControllerAura::GetWindow() {
99 return WmWindowAura::Get(root_window_controller_->GetRootWindow()); 87 return WmWindowAura::Get(root_window_controller_->GetRootWindow());
(...skipping 20 matching lines...) Expand all
120 ->FindTargetForEvent(root, &test_event); 108 ->FindTargetForEvent(root, &test_event);
121 return WmWindowAura::Get(static_cast<aura::Window*>(event_handler)); 109 return WmWindowAura::Get(static_cast<aura::Window*>(event_handler));
122 } 110 }
123 111
124 gfx::Point WmRootWindowControllerAura::GetLastMouseLocationInRoot() { 112 gfx::Point WmRootWindowControllerAura::GetLastMouseLocationInRoot() {
125 return root_window_controller_->GetHost() 113 return root_window_controller_->GetHost()
126 ->dispatcher() 114 ->dispatcher()
127 ->GetLastMouseLocationInRoot(); 115 ->GetLastMouseLocationInRoot();
128 } 116 }
129 117
130 void WmRootWindowControllerAura::AddObserver(
131 WmRootWindowControllerObserver* observer) {
132 observers_.AddObserver(observer);
133 }
134
135 void WmRootWindowControllerAura::RemoveObserver(
136 WmRootWindowControllerObserver* observer) {
137 observers_.RemoveObserver(observer);
138 }
139
140 void WmRootWindowControllerAura::OnShelfAlignmentChanged( 118 void WmRootWindowControllerAura::OnShelfAlignmentChanged(
141 WmWindow* root_window) { 119 WmWindow* root_window) {
142 if (WmWindowAura::GetAuraWindow(root_window) != 120 if (WmWindowAura::GetAuraWindow(root_window) !=
143 root_window_controller_->GetRootWindow()) 121 root_window_controller_->GetRootWindow())
144 return; 122 return;
145 123
146 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_, 124 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, *observers(),
147 OnShelfAlignmentChanged()); 125 OnShelfAlignmentChanged());
148 } 126 }
149 127
150 void WmRootWindowControllerAura::OnDisplayAdded( 128 void WmRootWindowControllerAura::OnDisplayAdded(
151 const display::Display& display) {} 129 const display::Display& display) {}
152 130
153 void WmRootWindowControllerAura::OnDisplayRemoved( 131 void WmRootWindowControllerAura::OnDisplayRemoved(
154 const display::Display& display) {} 132 const display::Display& display) {}
155 133
156 void WmRootWindowControllerAura::OnDisplayMetricsChanged( 134 void WmRootWindowControllerAura::OnDisplayMetricsChanged(
157 const display::Display& display, 135 const display::Display& display,
158 uint32_t metrics) { 136 uint32_t metrics) {
159 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_, 137 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, *observers(),
160 OnWorkAreaChanged()); 138 OnWorkAreaChanged());
161 } 139 }
162 140
163 } // namespace ash 141 } // namespace ash
OLDNEW
« no previous file with comments | « ash/aura/wm_root_window_controller_aura.h ('k') | ash/common/root_window_controller_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698