| 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 "ash/wm/status_area_layout_manager.h" | 5 #include "ash/wm/status_area_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/system/status_area_widget.h" |
| 7 #include "ash/wm/shelf_layout_manager.h" | 8 #include "ash/wm/shelf_layout_manager.h" |
| 8 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 9 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 10 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
| 11 | 12 |
| 12 namespace ash { | 13 namespace ash { |
| 13 namespace internal { | 14 namespace internal { |
| 14 | 15 |
| 15 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
| 16 // StatusAreaLayoutManager, public: | 17 // StatusAreaLayoutManager, public: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 42 | 43 |
| 43 void StatusAreaLayoutManager::OnChildWindowVisibilityChanged( | 44 void StatusAreaLayoutManager::OnChildWindowVisibilityChanged( |
| 44 aura::Window* child, bool visible) { | 45 aura::Window* child, bool visible) { |
| 45 } | 46 } |
| 46 | 47 |
| 47 void StatusAreaLayoutManager::SetChildBounds( | 48 void StatusAreaLayoutManager::SetChildBounds( |
| 48 aura::Window* child, | 49 aura::Window* child, |
| 49 const gfx::Rect& requested_bounds) { | 50 const gfx::Rect& requested_bounds) { |
| 50 // Only need to have the shelf do a layout if the child changing is the status | 51 // Only need to have the shelf do a layout if the child changing is the status |
| 51 // area and the shelf isn't in the process of doing a layout. | 52 // area and the shelf isn't in the process of doing a layout. |
| 52 if (child != shelf_->status()->GetNativeView() || in_layout_) { | 53 if (child != shelf_->status_area_widget()->GetNativeView() || in_layout_) { |
| 53 SetChildBoundsDirect(child, requested_bounds); | 54 SetChildBoundsDirect(child, requested_bounds); |
| 54 return; | 55 return; |
| 55 } | 56 } |
| 56 | 57 |
| 57 // If the size matches, no need to do anything. We don't check the location as | 58 // If the size matches, no need to do anything. We don't check the location as |
| 58 // that is managed by the shelf. | 59 // that is managed by the shelf. |
| 59 if (requested_bounds == child->bounds()) | 60 if (requested_bounds == child->bounds()) |
| 60 return; | 61 return; |
| 61 | 62 |
| 62 SetChildBoundsDirect(child, requested_bounds); | 63 SetChildBoundsDirect(child, requested_bounds); |
| 63 LayoutStatusArea(); | 64 LayoutStatusArea(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 //////////////////////////////////////////////////////////////////////////////// | 67 //////////////////////////////////////////////////////////////////////////////// |
| 67 // StatusAreaLayoutManager, private: | 68 // StatusAreaLayoutManager, private: |
| 68 | 69 |
| 69 void StatusAreaLayoutManager::LayoutStatusArea() { | 70 void StatusAreaLayoutManager::LayoutStatusArea() { |
| 70 // Shelf layout manager may be already doing layout. | 71 // Shelf layout manager may be already doing layout. |
| 71 if (shelf_->in_layout()) | 72 if (shelf_->in_layout()) |
| 72 return; | 73 return; |
| 73 | 74 |
| 74 AutoReset<bool> auto_reset_in_layout(&in_layout_, true); | 75 AutoReset<bool> auto_reset_in_layout(&in_layout_, true); |
| 75 shelf_->LayoutShelf(); | 76 shelf_->LayoutShelf(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace internal | 79 } // namespace internal |
| 79 } // namespace ash | 80 } // namespace ash |
| OLD | NEW |