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

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

Issue 2926793002: Use ContainsValue() instead of std::find() in ui/wm and ui/message_center (Closed)
Patch Set: Changed EXPECT_TRUE to EXPECT_FALSE Created 3 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/message_center/views/message_list_view.cc ('k') | ui/wm/core/transient_window_manager.cc » ('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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/scoped_observer.h" 12 #include "base/scoped_observer.h"
13 #include "base/stl_util.h"
13 #include "ui/aura/client/aura_constants.h" 14 #include "ui/aura/client/aura_constants.h"
14 #include "ui/aura/env.h" 15 #include "ui/aura/env.h"
15 #include "ui/aura/env_observer.h" 16 #include "ui/aura/env_observer.h"
16 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
17 #include "ui/aura/window_observer.h" 18 #include "ui/aura/window_observer.h"
18 #include "ui/base/class_property.h" 19 #include "ui/base/class_property.h"
19 #include "ui/base/ui_base_types.h" 20 #include "ui/base/ui_base_types.h"
20 #include "ui/compositor/layer.h" 21 #include "ui/compositor/layer.h"
21 #include "ui/wm/core/shadow.h" 22 #include "ui/wm/core/shadow.h"
22 #include "ui/wm/core/window_util.h" 23 #include "ui/wm/core/window_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return GetDefaultShadowElevationForWindow(window); 71 return GetDefaultShadowElevationForWindow(window);
71 } 72 }
72 73
73 // Returns the shadow style to be applied to |losing_active| when it is losing 74 // Returns the shadow style to be applied to |losing_active| when it is losing
74 // active to |gaining_active|. |gaining_active| may be of a type that hides when 75 // active to |gaining_active|. |gaining_active| may be of a type that hides when
75 // inactive, and as such we do not want to render |losing_active| as inactive. 76 // inactive, and as such we do not want to render |losing_active| as inactive.
76 ShadowElevation GetShadowElevationForWindowLosingActive( 77 ShadowElevation GetShadowElevationForWindowLosingActive(
77 aura::Window* losing_active, 78 aura::Window* losing_active,
78 aura::Window* gaining_active) { 79 aura::Window* gaining_active) {
79 if (gaining_active && GetHideOnDeactivate(gaining_active)) { 80 if (gaining_active && GetHideOnDeactivate(gaining_active)) {
80 aura::Window::Windows::const_iterator it = 81 if (base::ContainsValue(GetTransientChildren(losing_active),
81 std::find(GetTransientChildren(losing_active).begin(), 82 gaining_active))
82 GetTransientChildren(losing_active).end(),
83 gaining_active);
84 if (it != GetTransientChildren(losing_active).end())
85 return ShadowController::kActiveNormalShadowElevation; 83 return ShadowController::kActiveNormalShadowElevation;
86 } 84 }
87 return kInactiveNormalShadowElevation; 85 return kInactiveNormalShadowElevation;
88 } 86 }
89 87
90 } // namespace 88 } // namespace
91 89
92 // ShadowController::Impl ------------------------------------------------------ 90 // ShadowController::Impl ------------------------------------------------------
93 91
94 // Real implementation of the ShadowController. ShadowController observes 92 // Real implementation of the ShadowController. ShadowController observes
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 activation_client_->RemoveObserver(this); 274 activation_client_->RemoveObserver(this);
277 } 275 }
278 276
279 void ShadowController::OnWindowActivated(ActivationReason reason, 277 void ShadowController::OnWindowActivated(ActivationReason reason,
280 aura::Window* gained_active, 278 aura::Window* gained_active,
281 aura::Window* lost_active) { 279 aura::Window* lost_active) {
282 impl_->OnWindowActivated(reason, gained_active, lost_active); 280 impl_->OnWindowActivated(reason, gained_active, lost_active);
283 } 281 }
284 282
285 } // namespace wm 283 } // namespace wm
OLDNEW
« no previous file with comments | « ui/message_center/views/message_list_view.cc ('k') | ui/wm/core/transient_window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698