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

Side by Side Diff: ui/views/corewm/focus_controller.cc

Issue 14222019: Trying to activate a window in a workspace other than the current is ignored while a system modal d… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 8 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 (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/views/corewm/focus_controller.h" 5 #include "ui/views/corewm/focus_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "ui/aura/client/activation_change_observer.h" 8 #include "ui/aura/client/activation_change_observer.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/capture_client.h" 10 #include "ui/aura/client/capture_client.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 SetActiveWindow(activatable); 154 SetActiveWindow(activatable);
155 155
156 // If the window's ActivationChangeObserver shifted focus to a valid window, 156 // If the window's ActivationChangeObserver shifted focus to a valid window,
157 // we don't want to focus the window we thought would be focused by default. 157 // we don't want to focus the window we thought would be focused by default.
158 bool activation_changed_focus = last_focused_window != focused_window_; 158 bool activation_changed_focus = last_focused_window != focused_window_;
159 if (!updating_focus_ && (!activation_changed_focus || !focused_window_)) { 159 if (!updating_focus_ && (!activation_changed_focus || !focused_window_)) {
160 if (active_window_ && focusable) 160 if (active_window_ && focusable)
161 DCHECK(active_window_->Contains(focusable)); 161 DCHECK(active_window_->Contains(focusable));
162 SetFocusedWindow(focusable); 162 SetFocusedWindow(focusable);
163 } 163 }
164
165 FOR_EACH_OBSERVER(aura::client::ActivationChangeObserver,
166 activation_observers_,
167 OnWindowActivationRequestCompleted(
168 window, active_window_));
164 } 169 }
165 170
166 void FocusController::ResetFocusWithinActiveWindow(aura::Window* window) { 171 void FocusController::ResetFocusWithinActiveWindow(aura::Window* window) {
167 DCHECK(window); 172 DCHECK(window);
168 if (!active_window_) 173 if (!active_window_)
169 return; 174 return;
170 if (!active_window_->Contains(window)) 175 if (!active_window_->Contains(window))
171 return; 176 return;
172 SetFocusedWindow(window); 177 SetFocusedWindow(window);
173 } 178 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 aura::client::FocusChangeObserver* observer = 278 aura::client::FocusChangeObserver* observer =
274 aura::client::GetFocusChangeObserver(lost_focus); 279 aura::client::GetFocusChangeObserver(lost_focus);
275 if (observer) 280 if (observer)
276 observer->OnWindowFocused(focused_window_, lost_focus); 281 observer->OnWindowFocused(focused_window_, lost_focus);
277 observer = aura::client::GetFocusChangeObserver(focused_window_); 282 observer = aura::client::GetFocusChangeObserver(focused_window_);
278 if (observer) 283 if (observer)
279 observer->OnWindowFocused(focused_window_, lost_focus); 284 observer->OnWindowFocused(focused_window_, lost_focus);
280 } 285 }
281 286
282 void FocusController::SetActiveWindow(aura::Window* window) { 287 void FocusController::SetActiveWindow(aura::Window* window) {
283 if (updating_activation_ || window == active_window_) 288 if (updating_activation_ || window == active_window_)
sky 2013/04/23 17:45:39 Looking at this again could you instead add a bran
sschmitz 2013/04/23 19:04:39 Done.
284 return; 289 return;
285 290
286 DCHECK(rules_->CanActivateWindow(window)); 291 DCHECK(rules_->CanActivateWindow(window));
287 if (window) 292 if (window)
288 DCHECK_EQ(window, rules_->GetActivatableWindow(window)); 293 DCHECK_EQ(window, rules_->GetActivatableWindow(window));
289 294
290 base::AutoReset<bool> updating_activation(&updating_activation_, true); 295 base::AutoReset<bool> updating_activation(&updating_activation_, true);
291 aura::Window* lost_activation = active_window_; 296 aura::Window* lost_activation = active_window_;
292 if (active_window_ && observer_manager_.IsObserving(active_window_) && 297 if (active_window_ && observer_manager_.IsObserving(active_window_) &&
293 focused_window_ != active_window_) { 298 focused_window_ != active_window_) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) { 343 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) {
339 // Only focus |window| if it or any of its parents can be focused. Otherwise 344 // Only focus |window| if it or any of its parents can be focused. Otherwise
340 // FocusWindow() will focus the topmost window, which may not be the 345 // FocusWindow() will focus the topmost window, which may not be the
341 // currently focused one. 346 // currently focused one.
342 if (rules_->CanFocusWindow(GetToplevelWindow(window))) 347 if (rules_->CanFocusWindow(GetToplevelWindow(window)))
343 FocusWindow(window); 348 FocusWindow(window);
344 } 349 }
345 350
346 } // namespace corewm 351 } // namespace corewm
347 } // namespace views 352 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_controller_aura.cc ('k') | ui/views/corewm/focus_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698