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

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

Issue 944763002: Make Page Visibility API work when the browser window is visible or not Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/wm/core/focus_controller.h" 5 #include "ui/wm/core/focus_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "ui/aura/client/aura_constants.h" 8 #include "ui/aura/client/aura_constants.h"
9 #include "ui/aura/client/capture_client.h" 9 #include "ui/aura/client/capture_client.h"
10 #include "ui/aura/client/focus_change_observer.h" 10 #include "ui/aura/client/focus_change_observer.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 event->details().touch_points() == 1 && 171 event->details().touch_points() == 1 &&
172 !event->handled()) { 172 !event->handled()) {
173 WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target())); 173 WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target()));
174 } 174 }
175 } 175 }
176 176
177 //////////////////////////////////////////////////////////////////////////////// 177 ////////////////////////////////////////////////////////////////////////////////
178 // FocusController, aura::WindowObserver implementation: 178 // FocusController, aura::WindowObserver implementation:
179 179
180 void FocusController::OnWindowVisibilityChanged(aura::Window* window, 180 void FocusController::OnWindowVisibilityChanged(aura::Window* window,
181 bool visible) { 181 bool visible,
182 bool content_visible) {
182 if (!visible) 183 if (!visible)
183 WindowLostFocusFromDispositionChange(window, window->parent()); 184 WindowLostFocusFromDispositionChange(window, window->parent());
184 } 185 }
185 186
186 void FocusController::OnWindowDestroying(aura::Window* window) { 187 void FocusController::OnWindowDestroying(aura::Window* window) {
187 // A window's modality state will interfere with focus restoration during its 188 // A window's modality state will interfere with focus restoration during its
188 // destruction. 189 // destruction.
189 window->ClearProperty(aura::client::kModalKey); 190 window->ClearProperty(aura::client::kModalKey);
190 WindowLostFocusFromDispositionChange(window, window->parent()); 191 WindowLostFocusFromDispositionChange(window, window->parent());
191 } 192 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 347
347 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) { 348 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) {
348 // Only focus |window| if it or any of its parents can be focused. Otherwise 349 // Only focus |window| if it or any of its parents can be focused. Otherwise
349 // FocusWindow() will focus the topmost window, which may not be the 350 // FocusWindow() will focus the topmost window, which may not be the
350 // currently focused one. 351 // currently focused one.
351 if (rules_->CanFocusWindow(GetToplevelWindow(window))) 352 if (rules_->CanFocusWindow(GetToplevelWindow(window)))
352 FocusWindow(window); 353 FocusWindow(window);
353 } 354 }
354 355
355 } // namespace wm 356 } // namespace wm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698