| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/views/widget/desktop_layout_manager.h" | |
| 6 | |
| 7 #include "ui/aura/root_window.h" | |
| 8 #include "ui/gfx/rect.h" | |
| 9 | |
| 10 namespace views { | |
| 11 | |
| 12 DesktopLayoutManager::DesktopLayoutManager(aura::RootWindow* root_window) | |
| 13 : root_window_(root_window), | |
| 14 main_window_(NULL) { | |
| 15 } | |
| 16 | |
| 17 DesktopLayoutManager::~DesktopLayoutManager() {} | |
| 18 | |
| 19 void DesktopLayoutManager::OnWindowResized() { | |
| 20 if (main_window_) | |
| 21 SetMainWindowSize(); | |
| 22 } | |
| 23 | |
| 24 void DesktopLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | |
| 25 if (!main_window_) { | |
| 26 main_window_ = child; | |
| 27 | |
| 28 SetMainWindowSize(); | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 void DesktopLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { | |
| 33 if (main_window_ == child) | |
| 34 main_window_ = NULL; | |
| 35 } | |
| 36 | |
| 37 void DesktopLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { | |
| 38 } | |
| 39 | |
| 40 void DesktopLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, | |
| 41 bool visible) { | |
| 42 } | |
| 43 | |
| 44 void DesktopLayoutManager::SetChildBounds(aura::Window* child, | |
| 45 const gfx::Rect& requested_bounds) { | |
| 46 if (main_window_ != child) | |
| 47 SetChildBoundsDirect(child, requested_bounds); | |
| 48 } | |
| 49 | |
| 50 void DesktopLayoutManager::SetMainWindowSize() { | |
| 51 gfx::Rect bounds; | |
| 52 bounds.set_size(root_window_->GetHostSize()); | |
| 53 SetChildBoundsDirect(main_window_, bounds); | |
| 54 } | |
| 55 | |
| 56 } // namespace views | |
| OLD | NEW |