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/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shelf/shelf_widget.h" |
8 #include "ash/shell.h" | 10 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/property_util.h" | 12 #include "ash/wm/property_util.h" |
11 #include "ash/wm/shelf_layout_manager.h" | |
12 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
13 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
14 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
15 #include "ui/aura/test/test_windows.h" | 16 #include "ui/aura/test/test_windows.h" |
16 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
17 #include "ui/gfx/insets.h" | 18 #include "ui/gfx/insets.h" |
18 | 19 |
19 namespace ash { | 20 namespace ash { |
20 | 21 |
21 namespace { | 22 namespace { |
(...skipping 28 matching lines...) Expand all Loading... |
50 virtual void OnWindowPropertyChanged(aura::Window* window, | 51 virtual void OnWindowPropertyChanged(aura::Window* window, |
51 const void* key, | 52 const void* key, |
52 intptr_t old) OVERRIDE { | 53 intptr_t old) OVERRIDE { |
53 if (!window_) | 54 if (!window_) |
54 return; | 55 return; |
55 | 56 |
56 if (wm::IsWindowMaximized(window)) { | 57 if (wm::IsWindowMaximized(window)) { |
57 aura::Window* w = window_; | 58 aura::Window* w = window_; |
58 window_ = NULL; | 59 window_ = NULL; |
59 | 60 |
60 gfx::Rect shelf_bounds( | 61 gfx::Rect shelf_bounds(Shell::GetPrimaryRootWindowController()-> |
61 Shell::GetPrimaryRootWindowController()->shelf()->GetIdealBounds()); | 62 shelf_layout_manager()->GetIdealBounds()); |
62 const gfx::Rect& window_bounds(w->bounds()); | 63 const gfx::Rect& window_bounds(w->bounds()); |
63 w->SetBounds(gfx::Rect(window_bounds.x(), shelf_bounds.y() - 1, | 64 w->SetBounds(gfx::Rect(window_bounds.x(), shelf_bounds.y() - 1, |
64 window_bounds.width(), window_bounds.height())); | 65 window_bounds.width(), window_bounds.height())); |
65 } | 66 } |
66 } | 67 } |
67 | 68 |
68 private: | 69 private: |
69 aura::Window* window_; | 70 aura::Window* window_; |
70 | 71 |
71 DISALLOW_COPY_AND_ASSIGN(DontClobberRestoreBoundsWindowObserver); | 72 DISALLOW_COPY_AND_ASSIGN(DontClobberRestoreBoundsWindowObserver); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 // Directly setting the bounds triggers a slightly different code path. Verify | 150 // Directly setting the bounds triggers a slightly different code path. Verify |
150 // that too. | 151 // that too. |
151 window->SetBounds(window_bounds); | 152 window->SetBounds(window_bounds); |
152 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), | 153 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), |
153 window->bounds().ToString()); | 154 window->bounds().ToString()); |
154 } | 155 } |
155 | 156 |
156 } // namespace | 157 } // namespace |
157 } // namespace ash | 158 } // namespace ash |
OLD | NEW |