Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "ui/aura/client/aura_constants.h" | 11 #include "ui/aura/client/aura_constants.h" |
| 12 #include "ui/aura/client/capture_client.h" | 12 #include "ui/aura/client/capture_client.h" |
| 13 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
| 14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #include "ui/aura/window_event_dispatcher.h" | 15 #include "ui/aura/window_event_dispatcher.h" |
| 16 #include "ui/aura/window_property.h" | 16 #include "ui/aura/window_property.h" |
| 17 #include "ui/base/ui_base_types.h" | 17 #include "ui/base/ui_base_types.h" |
| 18 #include "ui/events/event.h" | 18 #include "ui/events/event.h" |
| 19 #include "ui/events/event_target.h" | 19 #include "ui/events/event_target.h" |
| 20 #include "ui/events/gestures/gesture_recognizer.h" | 20 #include "ui/events/gestures/gesture_recognizer.h" |
| 21 #include "ui/wm/core/window_animations.h" | 21 #include "ui/wm/core/window_animations.h" |
| 22 #include "ui/wm/core/window_util.h" | 22 #include "ui/wm/core/window_util.h" |
| 23 | 23 |
| 24 namespace wm { | 24 namespace wm { |
| 25 // Key for native window property that indicates if the window should have | |
|
Mike Wittman
2016/08/12 22:51:35
No need to repeat the comment in the implementatio
rbpotter
2016/08/15 18:03:46
Done.
| |
| 26 // bounds independent of its modal parent. | |
| 27 const char kHasIndependentBoundsKey[] = "__INDEPENDENT_BOUNDS__"; | |
| 25 | 28 |
| 26 // Transient child's modal parent. | 29 // Transient child's modal parent. |
| 27 extern const aura::WindowProperty<aura::Window*>* const kModalParentKey; | 30 extern const aura::WindowProperty<aura::Window*>* const kModalParentKey; |
| 28 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kModalParentKey, NULL); | 31 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kModalParentKey, NULL); |
| 29 | 32 |
| 30 namespace { | 33 namespace { |
| 31 | 34 |
| 32 bool HasAncestor(aura::Window* window, aura::Window* ancestor) { | 35 bool HasAncestor(aura::Window* window, aura::Window* ancestor) { |
| 33 if (!window) | 36 if (!window) |
| 34 return false; | 37 return false; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 | 124 |
| 122 void WindowModalityController::OnKeyEvent(ui::KeyEvent* event) { | 125 void WindowModalityController::OnKeyEvent(ui::KeyEvent* event) { |
| 123 aura::Window* target = static_cast<aura::Window*>(event->target()); | 126 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 124 if (GetModalTransient(target)) | 127 if (GetModalTransient(target)) |
| 125 event->SetHandled(); | 128 event->SetHandled(); |
| 126 } | 129 } |
| 127 | 130 |
| 128 void WindowModalityController::OnMouseEvent(ui::MouseEvent* event) { | 131 void WindowModalityController::OnMouseEvent(ui::MouseEvent* event) { |
| 129 aura::Window* target = static_cast<aura::Window*>(event->target()); | 132 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 130 if (ProcessLocatedEvent(target, event)) | 133 if (ProcessLocatedEvent(target, event)) |
| 131 event->SetHandled(); | 134 event->SetHandled(); |
| 132 } | 135 } |
| 133 | 136 |
| 134 void WindowModalityController::OnTouchEvent(ui::TouchEvent* event) { | 137 void WindowModalityController::OnTouchEvent(ui::TouchEvent* event) { |
| 135 aura::Window* target = static_cast<aura::Window*>(event->target()); | 138 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 136 if (ProcessLocatedEvent(target, event)) | 139 if (ProcessLocatedEvent(target, event)) |
| 137 event->SetHandled(); | 140 event->SetHandled(); |
| 138 } | 141 } |
| 139 | 142 |
| 140 //////////////////////////////////////////////////////////////////////////////// | 143 //////////////////////////////////////////////////////////////////////////////// |
| 141 // WindowModalityController, aura::EnvObserver implementation: | 144 // WindowModalityController, aura::EnvObserver implementation: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 } | 210 } |
| 208 | 211 |
| 209 AnimateWindow(modal_transient_child, WINDOW_ANIMATION_TYPE_BOUNCE); | 212 AnimateWindow(modal_transient_child, WINDOW_ANIMATION_TYPE_BOUNCE); |
| 210 } | 213 } |
| 211 if (event->type() == ui::ET_TOUCH_CANCELLED) | 214 if (event->type() == ui::ET_TOUCH_CANCELLED) |
| 212 return false; | 215 return false; |
| 213 return !!modal_transient_child; | 216 return !!modal_transient_child; |
| 214 } | 217 } |
| 215 | 218 |
| 216 } // namespace wm | 219 } // namespace wm |
| OLD | NEW |