OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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/aura_shell/laptop_mode_layout_manager.h" | |
6 | |
7 #include "ui/aura/client/aura_constants.h" | |
8 #include "ui/aura/window.h" | |
9 #include "ui/aura_shell/window_util.h" | |
10 #include "ui/base/ui_base_types.h" | |
11 #include "ui/gfx/screen.h" | |
12 | |
13 namespace aura_shell { | |
14 namespace internal { | |
15 | |
16 LaptopModeLayoutManager::LaptopModeLayoutManager() { | |
17 } | |
18 | |
19 LaptopModeLayoutManager::~LaptopModeLayoutManager() { | |
20 for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i) | |
21 (*i)->RemoveObserver(this); | |
22 } | |
23 | |
24 void LaptopModeLayoutManager::OnWindowResized() { | |
25 } | |
26 | |
27 void LaptopModeLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | |
28 windows_.insert(child); | |
29 child->AddObserver(this); | |
30 if (child->GetProperty(aura::kShowStateKey)) | |
31 UpdateBoundsFromShowState(child); | |
32 } | |
33 | |
34 void LaptopModeLayoutManager::OnWillRemoveWindowFromLayout( | |
35 aura::Window* child) { | |
36 windows_.erase(child); | |
37 child->RemoveObserver(this); | |
38 } | |
39 | |
40 void LaptopModeLayoutManager::OnChildWindowVisibilityChanged( | |
41 aura::Window* child, | |
42 bool visibile) { | |
43 } | |
44 | |
45 void LaptopModeLayoutManager::SetChildBounds( | |
46 aura::Window* child, | |
47 const gfx::Rect& requested_bounds) { | |
48 gfx::Rect bounds = requested_bounds; | |
49 // Avoid a janky resize on startup by ensuring the initial bounds fill the | |
50 // screen. | |
51 if (child->type() == aura::WINDOW_TYPE_NORMAL) | |
oshima
2011/12/14 17:41:02
since you're now setting show state, shouldn't you
James Cook
2011/12/14 18:24:37
Ah, good point. Done.
| |
52 bounds = gfx::Screen::GetPrimaryMonitorBounds(); | |
53 SetChildBoundsDirect(child, bounds); | |
54 } | |
55 | |
56 void LaptopModeLayoutManager::OnWindowPropertyChanged(aura::Window* window, | |
57 const char* name, | |
58 void* old) { | |
59 if (name == aura::kShowStateKey) | |
60 UpdateBoundsFromShowState(window); | |
61 } | |
62 | |
63 } // namespace internal | |
64 } // namespace aura_shell | |
OLD | NEW |