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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 if (!layer()) { | 402 if (!layer()) { |
403 // Transforms aren't supported on layerless windows. | 403 // Transforms aren't supported on layerless windows. |
404 NOTREACHED(); | 404 NOTREACHED(); |
405 return; | 405 return; |
406 } | 406 } |
407 FOR_EACH_OBSERVER(WindowObserver, observers_, | 407 FOR_EACH_OBSERVER(WindowObserver, observers_, |
408 OnWindowTransforming(this)); | 408 OnWindowTransforming(this)); |
409 layer()->SetTransform(transform); | 409 layer()->SetTransform(transform); |
410 FOR_EACH_OBSERVER(WindowObserver, observers_, | 410 FOR_EACH_OBSERVER(WindowObserver, observers_, |
411 OnWindowTransformed(this)); | 411 OnWindowTransformed(this)); |
| 412 NotifyAncestorWindowTransformed(this); |
412 } | 413 } |
413 | 414 |
414 void Window::SetLayoutManager(LayoutManager* layout_manager) { | 415 void Window::SetLayoutManager(LayoutManager* layout_manager) { |
415 if (layout_manager == layout_manager_) | 416 if (layout_manager == layout_manager_) |
416 return; | 417 return; |
417 layout_manager_.reset(layout_manager); | 418 layout_manager_.reset(layout_manager); |
418 if (!layout_manager) | 419 if (!layout_manager) |
419 return; | 420 return; |
420 // If we're changing to a new layout manager, ensure it is aware of all the | 421 // If we're changing to a new layout manager, ensure it is aware of all the |
421 // existing child windows. | 422 // existing child windows. |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 } | 1311 } |
1311 | 1312 |
1312 void Window::NotifyWindowVisibilityChangedUp(aura::Window* target, | 1313 void Window::NotifyWindowVisibilityChangedUp(aura::Window* target, |
1313 bool visible) { | 1314 bool visible) { |
1314 for (Window* window = this; window; window = window->parent()) { | 1315 for (Window* window = this; window; window = window->parent()) { |
1315 bool ret = window->NotifyWindowVisibilityChangedAtReceiver(target, visible); | 1316 bool ret = window->NotifyWindowVisibilityChangedAtReceiver(target, visible); |
1316 DCHECK(ret); | 1317 DCHECK(ret); |
1317 } | 1318 } |
1318 } | 1319 } |
1319 | 1320 |
| 1321 void Window::NotifyAncestorWindowTransformed(Window* source) { |
| 1322 FOR_EACH_OBSERVER(WindowObserver, observers_, |
| 1323 OnAncestorWindowTransformed(source, this)); |
| 1324 for (Window::Windows::const_iterator it = children_.begin(); |
| 1325 it != children_.end(); ++it) { |
| 1326 (*it)->NotifyAncestorWindowTransformed(source); |
| 1327 } |
| 1328 } |
| 1329 |
1320 void Window::OnWindowBoundsChanged(const gfx::Rect& old_bounds) { | 1330 void Window::OnWindowBoundsChanged(const gfx::Rect& old_bounds) { |
1321 if (layer()) { | 1331 if (layer()) { |
1322 bounds_ = layer()->bounds(); | 1332 bounds_ = layer()->bounds(); |
1323 if (parent_ && !parent_->layer()) { | 1333 if (parent_ && !parent_->layer()) { |
1324 gfx::Vector2d offset; | 1334 gfx::Vector2d offset; |
1325 aura::Window* ancestor_with_layer = | 1335 aura::Window* ancestor_with_layer = |
1326 parent_->GetAncestorWithLayer(&offset); | 1336 parent_->GetAncestorWithLayer(&offset); |
1327 if (ancestor_with_layer) | 1337 if (ancestor_with_layer) |
1328 bounds_.Offset(-offset); | 1338 bounds_.Offset(-offset); |
1329 } | 1339 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 return window; | 1459 return window; |
1450 if (offset) | 1460 if (offset) |
1451 *offset += window->bounds().OffsetFromOrigin(); | 1461 *offset += window->bounds().OffsetFromOrigin(); |
1452 } | 1462 } |
1453 if (offset) | 1463 if (offset) |
1454 *offset = gfx::Vector2d(); | 1464 *offset = gfx::Vector2d(); |
1455 return NULL; | 1465 return NULL; |
1456 } | 1466 } |
1457 | 1467 |
1458 } // namespace aura | 1468 } // namespace aura |
OLD | NEW |