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

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

Issue 2185773002: Refactor: remove SetDisplayWorkAreaInsets calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/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/wm/workspace/workspace_layout_manager_backdrop_delegate.h" 10 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h"
11 #include "ash/common/wm_root_window_controller_observer.h" 11 #include "ash/common/wm_root_window_controller_observer.h"
12 #include "ash/display/window_tree_host_manager.h" 12 #include "ash/display/window_tree_host_manager.h"
13 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
14 #include "ash/shelf/shelf.h" 14 #include "ash/shelf/shelf.h"
15 #include "ash/shelf/shelf_widget.h" 15 #include "ash/shelf/shelf_widget.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "ash/wm/workspace_controller.h" 17 #include "ash/wm/workspace_controller.h"
18 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
19 #include "ui/aura/window_event_dispatcher.h" 19 #include "ui/aura/window_event_dispatcher.h"
20 #include "ui/aura/window_property.h" 20 #include "ui/aura/window_property.h"
21 #include "ui/aura/window_tree_host.h" 21 #include "ui/aura/window_tree_host.h"
22 #include "ui/display/screen.h"
22 #include "ui/events/event_targeter.h" 23 #include "ui/events/event_targeter.h"
23 #include "ui/events/event_utils.h" 24 #include "ui/events/event_utils.h"
24 25
25 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmRootWindowControllerAura*); 26 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmRootWindowControllerAura*);
26 27
27 namespace ash { 28 namespace ash {
28 29
29 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings. 30 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings.
30 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmRootWindowControllerAura, 31 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmRootWindowControllerAura,
31 kWmRootWindowControllerKey, 32 kWmRootWindowControllerKey,
32 nullptr); 33 nullptr);
33 34
34 WmRootWindowControllerAura::WmRootWindowControllerAura( 35 WmRootWindowControllerAura::WmRootWindowControllerAura(
35 RootWindowController* root_window_controller) 36 RootWindowController* root_window_controller)
36 : root_window_controller_(root_window_controller) { 37 : root_window_controller_(root_window_controller) {
37 root_window_controller_->GetRootWindow()->SetProperty( 38 root_window_controller_->GetRootWindow()->SetProperty(
38 kWmRootWindowControllerKey, this); 39 kWmRootWindowControllerKey, this);
39 WmShell::Get()->AddShellObserver(this); 40 WmShell::Get()->AddShellObserver(this);
41 display::Screen::GetScreen()->AddObserver(this);
40 } 42 }
41 43
42 WmRootWindowControllerAura::~WmRootWindowControllerAura() { 44 WmRootWindowControllerAura::~WmRootWindowControllerAura() {
43 WmShell::Get()->RemoveShellObserver(this); 45 WmShell::Get()->RemoveShellObserver(this);
46 display::Screen::GetScreen()->RemoveObserver(this);
44 } 47 }
45 48
46 // static 49 // static
47 const WmRootWindowControllerAura* WmRootWindowControllerAura::Get( 50 const WmRootWindowControllerAura* WmRootWindowControllerAura::Get(
48 const aura::Window* window) { 51 const aura::Window* window) {
49 if (!window) 52 if (!window)
50 return nullptr; 53 return nullptr;
51 54
52 RootWindowController* root_window_controller = 55 RootWindowController* root_window_controller =
53 GetRootWindowController(window); 56 GetRootWindowController(window);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void WmRootWindowControllerAura::AddObserver( 128 void WmRootWindowControllerAura::AddObserver(
126 WmRootWindowControllerObserver* observer) { 129 WmRootWindowControllerObserver* observer) {
127 observers_.AddObserver(observer); 130 observers_.AddObserver(observer);
128 } 131 }
129 132
130 void WmRootWindowControllerAura::RemoveObserver( 133 void WmRootWindowControllerAura::RemoveObserver(
131 WmRootWindowControllerObserver* observer) { 134 WmRootWindowControllerObserver* observer) {
132 observers_.RemoveObserver(observer); 135 observers_.RemoveObserver(observer);
133 } 136 }
134 137
135 void WmRootWindowControllerAura::OnDisplayWorkAreaInsetsChanged() {
136 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_,
137 OnWorkAreaChanged());
138 }
139
140 void WmRootWindowControllerAura::OnFullscreenStateChanged( 138 void WmRootWindowControllerAura::OnFullscreenStateChanged(
141 bool is_fullscreen, 139 bool is_fullscreen,
142 WmWindow* root_window) { 140 WmWindow* root_window) {
143 if (WmWindowAura::GetAuraWindow(root_window) != 141 if (WmWindowAura::GetAuraWindow(root_window) !=
144 root_window_controller_->GetRootWindow()) 142 root_window_controller_->GetRootWindow())
145 return; 143 return;
146 144
147 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_, 145 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_,
148 OnFullscreenStateChanged(is_fullscreen)); 146 OnFullscreenStateChanged(is_fullscreen));
149 } 147 }
150 148
151 void WmRootWindowControllerAura::OnShelfAlignmentChanged( 149 void WmRootWindowControllerAura::OnShelfAlignmentChanged(
152 WmWindow* root_window) { 150 WmWindow* root_window) {
153 if (WmWindowAura::GetAuraWindow(root_window) != 151 if (WmWindowAura::GetAuraWindow(root_window) !=
154 root_window_controller_->GetRootWindow()) 152 root_window_controller_->GetRootWindow())
155 return; 153 return;
156 154
157 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_, 155 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_,
158 OnShelfAlignmentChanged()); 156 OnShelfAlignmentChanged());
159 } 157 }
160 158
159 void WmRootWindowControllerAura::OnDisplayMetricsChanged(
160 const display::Display& display,
161 uint32_t metrics) {
162 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_,
163 OnWorkAreaChanged());
164 }
165
166 void WmRootWindowControllerAura::OnDisplayAdded(
167 const display::Display& display) {}
168
169 void WmRootWindowControllerAura::OnDisplayRemoved(
170 const display::Display& display) {}
oshima 2016/07/26 20:53:03 nit: please keep the same order as in the header.
hariank 2016/07/26 22:05:16 Done.
171
161 } // namespace ash 172 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698