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

Side by Side Diff: ui/wm/core/window_modality_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/window_modality_controller.h" 5 #include "ui/wm/core/window_modality_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 window->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE && 152 window->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE &&
153 window->IsVisible()) { 153 window->IsVisible()) {
154 ActivateWindow(window); 154 ActivateWindow(window);
155 ui::GestureRecognizer::Get()->TransferEventsTo(GetTransientParent(window), 155 ui::GestureRecognizer::Get()->TransferEventsTo(GetTransientParent(window),
156 NULL); 156 NULL);
157 } 157 }
158 } 158 }
159 159
160 void WindowModalityController::OnWindowVisibilityChanged( 160 void WindowModalityController::OnWindowVisibilityChanged(
161 aura::Window* window, 161 aura::Window* window,
162 bool visible) { 162 bool visible, bool content_visible) {
163 if (visible && window->GetProperty(aura::client::kModalKey) != 163 if (visible && window->GetProperty(aura::client::kModalKey) !=
164 ui::MODAL_TYPE_NONE) { 164 ui::MODAL_TYPE_NONE) {
165 ui::GestureRecognizer::Get()->TransferEventsTo(GetTransientParent(window), 165 ui::GestureRecognizer::Get()->TransferEventsTo(GetTransientParent(window),
166 NULL); 166 NULL);
167 // Make sure no other window has capture, otherwise |window| won't get mouse 167 // Make sure no other window has capture, otherwise |window| won't get mouse
168 // events. 168 // events.
169 aura::Window* capture_window = aura::client::GetCaptureWindow(window); 169 aura::Window* capture_window = aura::client::GetCaptureWindow(window);
170 if (capture_window) 170 if (capture_window)
171 capture_window->ReleaseCapture(); 171 capture_window->ReleaseCapture();
172 } 172 }
(...skipping 19 matching lines...) Expand all
192 } 192 }
193 193
194 AnimateWindow(modal_transient_child, WINDOW_ANIMATION_TYPE_BOUNCE); 194 AnimateWindow(modal_transient_child, WINDOW_ANIMATION_TYPE_BOUNCE);
195 } 195 }
196 if (event->type() == ui::ET_TOUCH_CANCELLED) 196 if (event->type() == ui::ET_TOUCH_CANCELLED)
197 return false; 197 return false;
198 return !!modal_transient_child; 198 return !!modal_transient_child;
199 } 199 }
200 200
201 } // namespace wm 201 } // namespace wm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698