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

Side by Side Diff: chromecast/graphics/cast_focus_client_aura.cc

Issue 2920723002: Use ContainsValue() instead of std::find() in chromecast/ (Closed)
Patch Set: Changed ContainsValue() -> base::ContainsValue() 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 | « chromecast/base/observer.h ('k') | chromecast/media/audio/cast_audio_mixer.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "base/stl_util.h"
alokp 2017/06/01 19:01:21 base/stl_util.h should be included after cast_focu
Tripta 2017/06/02 04:40:22 Have made the changes.
5 #include "chromecast/graphics/cast_focus_client_aura.h" 6 #include "chromecast/graphics/cast_focus_client_aura.h"
6 7
7 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
8 9
9 #define LOG_WINDOW_INFO(top_level, window) \ 10 #define LOG_WINDOW_INFO(top_level, window) \
10 "top-level: " << (top_level)->id() << ": '" << (top_level)->GetName() \ 11 "top-level: " << (top_level)->id() << ": '" << (top_level)->GetName() \
11 << "', window: " << (window)->id() << ": '" \ 12 << "', window: " << (window)->id() << ": '" \
12 << (window)->GetName() << "'" 13 << (window)->GetName() << "'"
13 14
14 namespace chromecast { 15 namespace chromecast {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // focus request if it isn't for the topmost window. If it is for a lower 118 // focus request if it isn't for the topmost window. If it is for a lower
118 // window, then we'll track it to focus it later when it rises to the top. 119 // window, then we'll track it to focus it later when it rises to the top.
119 void CastFocusClientAura::FocusWindow(aura::Window* window) { 120 void CastFocusClientAura::FocusWindow(aura::Window* window) {
120 if (window) { 121 if (window) {
121 if (!window->CanFocus()) { 122 if (!window->CanFocus()) {
122 return; 123 return;
123 } 124 }
124 aura::Window* top_level = GetZOrderWindow(window); 125 aura::Window* top_level = GetZOrderWindow(window);
125 DCHECK(top_level); 126 DCHECK(top_level);
126 DLOG(INFO) << "Requesting focus for " << LOG_WINDOW_INFO(top_level, window); 127 DLOG(INFO) << "Requesting focus for " << LOG_WINDOW_INFO(top_level, window);
127 auto iter = 128 if(!base::ContainsValue(focusable_windows_, window)) {
128 std::find(focusable_windows_.begin(), focusable_windows_.end(), window);
129 if (iter == focusable_windows_.end()) {
130 // We're not yet tracking this focusable window, so start tracking it as a 129 // We're not yet tracking this focusable window, so start tracking it as a
131 // potential focus target. 130 // potential focus target.
132 window->AddObserver(this); 131 window->AddObserver(this);
133 focusable_windows_.push_back(window); 132 focusable_windows_.push_back(window);
134 } 133 }
135 } 134 }
136 135
137 // Check whether this new window is the most appropriate to focus. 136 // Check whether this new window is the most appropriate to focus.
138 UpdateWindowFocus(); 137 UpdateWindowFocus();
139 } 138 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 241
243 aura::Window* CastFocusClientAura::GetToplevelWindow(aura::Window* window) { 242 aura::Window* CastFocusClientAura::GetToplevelWindow(aura::Window* window) {
244 return GetZOrderWindow(window); 243 return GetZOrderWindow(window);
245 } 244 }
246 245
247 bool CastFocusClientAura::CanActivateWindow(aura::Window* window) const { 246 bool CastFocusClientAura::CanActivateWindow(aura::Window* window) const {
248 return true; 247 return true;
249 } 248 }
250 249
251 } // namespace chromecast 250 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/base/observer.h ('k') | chromecast/media/audio/cast_audio_mixer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698