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

Side by Side Diff: ui/wm/core/shadow_controller.cc

Issue 1151133003: Added an ActivationReason parameter to ActivationChangeObserver::OnWindowActivated(...). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uploaded diff based on dependant CL. Created 5 years, 6 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 | « ui/wm/core/shadow_controller.h ('k') | ui/wm/public/activation_change_observer.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/wm/core/shadow_controller.h" 5 #include "ui/wm/core/shadow_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 friend class base::RefCounted<Impl>; 106 friend class base::RefCounted<Impl>;
107 friend class ShadowController; 107 friend class ShadowController;
108 friend class ShadowController::TestApi; 108 friend class ShadowController::TestApi;
109 109
110 typedef std::map<aura::Window*, linked_ptr<Shadow> > WindowShadowMap; 110 typedef std::map<aura::Window*, linked_ptr<Shadow> > WindowShadowMap;
111 111
112 Impl(); 112 Impl();
113 ~Impl() override; 113 ~Impl() override;
114 114
115 // Forwarded from ShadowController. 115 // Forwarded from ShadowController.
116 void OnWindowActivated(aura::Window* gained_active, 116 void OnWindowActivated(ActivationReason reason,
117 aura::Window* gained_active,
117 aura::Window* lost_active); 118 aura::Window* lost_active);
118 119
119 // Checks if |window| is visible and contains a property requesting a shadow. 120 // Checks if |window| is visible and contains a property requesting a shadow.
120 bool ShouldShowShadowForWindow(aura::Window* window) const; 121 bool ShouldShowShadowForWindow(aura::Window* window) const;
121 122
122 // Returns |window|'s shadow from |window_shadows_|, or NULL if no shadow 123 // Returns |window|'s shadow from |window_shadows_|, or NULL if no shadow
123 // exists. 124 // exists.
124 Shadow* GetShadowForWindow(aura::Window* window); 125 Shadow* GetShadowForWindow(aura::Window* window);
125 126
126 // Updates the shadow styles for windows when activation changes. 127 // Updates the shadow styles for windows when activation changes.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 Shadow* shadow = GetShadowForWindow(window); 177 Shadow* shadow = GetShadowForWindow(window);
177 if (shadow) 178 if (shadow)
178 shadow->SetContentBounds(gfx::Rect(new_bounds.size())); 179 shadow->SetContentBounds(gfx::Rect(new_bounds.size()));
179 } 180 }
180 181
181 void ShadowController::Impl::OnWindowDestroyed(aura::Window* window) { 182 void ShadowController::Impl::OnWindowDestroyed(aura::Window* window) {
182 window_shadows_.erase(window); 183 window_shadows_.erase(window);
183 observer_manager_.Remove(window); 184 observer_manager_.Remove(window);
184 } 185 }
185 186
186 void ShadowController::Impl::OnWindowActivated(aura::Window* gained_active, 187 void ShadowController::Impl::OnWindowActivated(ActivationReason reason,
188 aura::Window* gained_active,
187 aura::Window* lost_active) { 189 aura::Window* lost_active) {
188 if (gained_active) { 190 if (gained_active) {
189 Shadow* shadow = GetShadowForWindow(gained_active); 191 Shadow* shadow = GetShadowForWindow(gained_active);
190 if (shadow && !ShouldUseSmallShadowForWindow(gained_active)) 192 if (shadow && !ShouldUseSmallShadowForWindow(gained_active))
191 shadow->SetStyle(Shadow::STYLE_ACTIVE); 193 shadow->SetStyle(Shadow::STYLE_ACTIVE);
192 } 194 }
193 if (lost_active) { 195 if (lost_active) {
194 Shadow* shadow = GetShadowForWindow(lost_active); 196 Shadow* shadow = GetShadowForWindow(lost_active);
195 if (shadow && !ShouldUseSmallShadowForWindow(lost_active)) { 197 if (shadow && !ShouldUseSmallShadowForWindow(lost_active)) {
196 shadow->SetStyle(GetShadowStyleForWindowLosingActive(lost_active, 198 shadow->SetStyle(GetShadowStyleForWindowLosingActive(lost_active,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 : activation_client_(activation_client), 266 : activation_client_(activation_client),
265 impl_(Impl::GetInstance()) { 267 impl_(Impl::GetInstance()) {
266 // Watch for window activation changes. 268 // Watch for window activation changes.
267 activation_client_->AddObserver(this); 269 activation_client_->AddObserver(this);
268 } 270 }
269 271
270 ShadowController::~ShadowController() { 272 ShadowController::~ShadowController() {
271 activation_client_->RemoveObserver(this); 273 activation_client_->RemoveObserver(this);
272 } 274 }
273 275
274 void ShadowController::OnWindowActivated(aura::Window* gained_active, 276 void ShadowController::OnWindowActivated(ActivationReason reason,
277 aura::Window* gained_active,
275 aura::Window* lost_active) { 278 aura::Window* lost_active) {
276 impl_->OnWindowActivated(gained_active, lost_active); 279 impl_->OnWindowActivated(reason, gained_active, lost_active);
277 } 280 }
278 281
279 // ShadowController::TestApi --------------------------------------------------- 282 // ShadowController::TestApi ---------------------------------------------------
280 283
281 Shadow* ShadowController::TestApi::GetShadowForWindow(aura::Window* window) { 284 Shadow* ShadowController::TestApi::GetShadowForWindow(aura::Window* window) {
282 return controller_->impl_->GetShadowForWindow(window); 285 return controller_->impl_->GetShadowForWindow(window);
283 } 286 }
284 287
285 } // namespace wm 288 } // namespace wm
OLDNEW
« no previous file with comments | « ui/wm/core/shadow_controller.h ('k') | ui/wm/public/activation_change_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698