| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 509 |
| 510 Window* old_root = child->GetRootWindow(); | 510 Window* old_root = child->GetRootWindow(); |
| 511 | 511 |
| 512 DCHECK(std::find(children_.begin(), children_.end(), child) == | 512 DCHECK(std::find(children_.begin(), children_.end(), child) == |
| 513 children_.end()); | 513 children_.end()); |
| 514 if (child->parent()) | 514 if (child->parent()) |
| 515 child->parent()->RemoveChildImpl(child, this); | 515 child->parent()->RemoveChildImpl(child, this); |
| 516 | 516 |
| 517 gfx::Vector2d offset; | 517 gfx::Vector2d offset; |
| 518 aura::Window* ancestor_with_layer = GetAncestorWithLayer(&offset); | 518 aura::Window* ancestor_with_layer = GetAncestorWithLayer(&offset); |
| 519 |
| 520 child->parent_ = this; |
| 521 |
| 519 if (ancestor_with_layer) { | 522 if (ancestor_with_layer) { |
| 520 offset += child->bounds().OffsetFromOrigin(); | 523 offset += child->bounds().OffsetFromOrigin(); |
| 521 child->ReparentLayers(ancestor_with_layer->layer(), offset); | 524 child->ReparentLayers(ancestor_with_layer->layer(), offset); |
| 522 } | 525 } |
| 523 | 526 |
| 524 child->parent_ = this; | |
| 525 | |
| 526 children_.push_back(child); | 527 children_.push_back(child); |
| 527 if (layout_manager_) | 528 if (layout_manager_) |
| 528 layout_manager_->OnWindowAddedToLayout(child); | 529 layout_manager_->OnWindowAddedToLayout(child); |
| 529 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowAdded(child)); | 530 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowAdded(child)); |
| 530 child->OnParentChanged(); | 531 child->OnParentChanged(); |
| 531 | 532 |
| 532 Window* root_window = GetRootWindow(); | 533 Window* root_window = GetRootWindow(); |
| 533 if (root_window && old_root != root_window) { | 534 if (root_window && old_root != root_window) { |
| 534 root_window->GetHost()->dispatcher()->OnWindowAddedToRootWindow(child); | 535 root_window->GetHost()->dispatcher()->OnWindowAddedToRootWindow(child); |
| 535 child->NotifyAddedToRootWindow(); | 536 child->NotifyAddedToRootWindow(); |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 return window; | 1436 return window; |
| 1436 if (offset) | 1437 if (offset) |
| 1437 *offset += window->bounds().OffsetFromOrigin(); | 1438 *offset += window->bounds().OffsetFromOrigin(); |
| 1438 } | 1439 } |
| 1439 if (offset) | 1440 if (offset) |
| 1440 *offset = gfx::Vector2d(); | 1441 *offset = gfx::Vector2d(); |
| 1441 return NULL; | 1442 return NULL; |
| 1442 } | 1443 } |
| 1443 | 1444 |
| 1444 } // namespace aura | 1445 } // namespace aura |
| OLD | NEW |