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/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 | 260 |
261 void Window::SetTransform(const gfx::Transform& transform) { | 261 void Window::SetTransform(const gfx::Transform& transform) { |
262 for (WindowObserver& observer : observers_) | 262 for (WindowObserver& observer : observers_) |
263 observer.OnWindowTransforming(this); | 263 observer.OnWindowTransforming(this); |
264 gfx::Transform old_transform = layer()->transform(); | 264 gfx::Transform old_transform = layer()->transform(); |
265 layer()->SetTransform(transform); | 265 layer()->SetTransform(transform); |
266 port_->OnDidChangeTransform(old_transform, transform); | 266 port_->OnDidChangeTransform(old_transform, transform); |
267 for (WindowObserver& observer : observers_) | 267 for (WindowObserver& observer : observers_) |
268 observer.OnWindowTransformed(this); | 268 observer.OnWindowTransformed(this); |
269 NotifyAncestorWindowTransformed(this); | |
270 } | 269 } |
271 | 270 |
272 void Window::SetLayoutManager(LayoutManager* layout_manager) { | 271 void Window::SetLayoutManager(LayoutManager* layout_manager) { |
273 if (layout_manager == layout_manager_.get()) | 272 if (layout_manager == layout_manager_.get()) |
274 return; | 273 return; |
275 layout_manager_.reset(layout_manager); | 274 layout_manager_.reset(layout_manager); |
276 if (!layout_manager) | 275 if (!layout_manager) |
277 return; | 276 return; |
278 // If we're changing to a new layout manager, ensure it is aware of all the | 277 // If we're changing to a new layout manager, ensure it is aware of all the |
279 // existing child windows. | 278 // existing child windows. |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 void Window::NotifyWindowVisibilityChangedUp(aura::Window* target, | 963 void Window::NotifyWindowVisibilityChangedUp(aura::Window* target, |
965 bool visible) { | 964 bool visible) { |
966 // Start with the parent as we already notified |this| | 965 // Start with the parent as we already notified |this| |
967 // in NotifyWindowVisibilityChangedDown. | 966 // in NotifyWindowVisibilityChangedDown. |
968 for (Window* window = parent(); window; window = window->parent()) { | 967 for (Window* window = parent(); window; window = window->parent()) { |
969 bool ret = window->NotifyWindowVisibilityChangedAtReceiver(target, visible); | 968 bool ret = window->NotifyWindowVisibilityChangedAtReceiver(target, visible); |
970 DCHECK(ret); | 969 DCHECK(ret); |
971 } | 970 } |
972 } | 971 } |
973 | 972 |
974 void Window::NotifyAncestorWindowTransformed(Window* source) { | |
975 for (WindowObserver& observer : observers_) | |
976 observer.OnAncestorWindowTransformed(source, this); | |
977 for (Window::Windows::const_iterator it = children_.begin(); | |
978 it != children_.end(); ++it) { | |
979 (*it)->NotifyAncestorWindowTransformed(source); | |
980 } | |
981 } | |
982 | |
983 bool Window::CleanupGestureState() { | 973 bool Window::CleanupGestureState() { |
984 bool state_modified = false; | 974 bool state_modified = false; |
985 state_modified |= ui::GestureRecognizer::Get()->CancelActiveTouches(this); | 975 state_modified |= ui::GestureRecognizer::Get()->CancelActiveTouches(this); |
986 state_modified |= | 976 state_modified |= |
987 ui::GestureRecognizer::Get()->CleanupStateForConsumer(this); | 977 ui::GestureRecognizer::Get()->CleanupStateForConsumer(this); |
988 for (Window::Windows::iterator iter = children_.begin(); | 978 for (Window::Windows::iterator iter = children_.begin(); |
989 iter != children_.end(); | 979 iter != children_.end(); |
990 ++iter) { | 980 ++iter) { |
991 state_modified |= (*iter)->CleanupGestureState(); | 981 state_modified |= (*iter)->CleanupGestureState(); |
992 } | 982 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 layer_name = "Unnamed Window"; | 1075 layer_name = "Unnamed Window"; |
1086 | 1076 |
1087 if (id_ != -1) | 1077 if (id_ != -1) |
1088 layer_name += " " + base::IntToString(id_); | 1078 layer_name += " " + base::IntToString(id_); |
1089 | 1079 |
1090 layer()->set_name(layer_name); | 1080 layer()->set_name(layer_name); |
1091 #endif | 1081 #endif |
1092 } | 1082 } |
1093 | 1083 |
1094 } // namespace aura | 1084 } // namespace aura |
OLD | NEW |