OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/window_positioner.h" | 5 #include "ash/wm/window_positioner.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell/toplevel_window.h" | 8 #include "ash/shell/toplevel_window.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/window_positioner.h" | 10 #include "ash/wm/window_positioner.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 bounds = widget2->GetWindowBoundsInScreen(); | 99 bounds = widget2->GetWindowBoundsInScreen(); |
100 EXPECT_EQ("300x300", bounds.size().ToString()); | 100 EXPECT_EQ("300x300", bounds.size().ToString()); |
101 } | 101 } |
102 | 102 |
103 namespace { | 103 namespace { |
104 | 104 |
105 // A WidgetDelegate that returns the out of display saved bounds. | 105 // A WidgetDelegate that returns the out of display saved bounds. |
106 class OutOfDisplayDelegate : public views::WidgetDelegate { | 106 class OutOfDisplayDelegate : public views::WidgetDelegate { |
107 public: | 107 public: |
108 explicit OutOfDisplayDelegate(views::Widget* widget) : widget_(widget) {} | 108 explicit OutOfDisplayDelegate(views::Widget* widget) : widget_(widget) {} |
109 virtual ~OutOfDisplayDelegate() {} | 109 ~OutOfDisplayDelegate() override {} |
110 | 110 |
111 // Overridden from WidgetDelegate: | 111 // Overridden from WidgetDelegate: |
112 virtual void DeleteDelegate() override { | 112 void DeleteDelegate() override { delete this; } |
113 delete this; | 113 views::Widget* GetWidget() override { return widget_; } |
114 } | 114 const views::Widget* GetWidget() const override { return widget_; } |
115 virtual views::Widget* GetWidget() override { | 115 bool GetSavedWindowPlacement(const views::Widget* widget, |
116 return widget_; | 116 gfx::Rect* bounds, |
117 } | 117 ui::WindowShowState* show_state) const override { |
118 virtual const views::Widget* GetWidget() const override { | |
119 return widget_; | |
120 } | |
121 virtual bool GetSavedWindowPlacement( | |
122 const views::Widget* widget, | |
123 gfx::Rect* bounds, | |
124 ui::WindowShowState* show_state) const override { | |
125 bounds->SetRect(450, 10, 100, 100); | 118 bounds->SetRect(450, 10, 100, 100); |
126 *show_state = ui::SHOW_STATE_NORMAL; | 119 *show_state = ui::SHOW_STATE_NORMAL; |
127 return true; | 120 return true; |
128 } | 121 } |
129 | 122 |
130 private: | 123 private: |
131 views::Widget* widget_; | 124 views::Widget* widget_; |
132 | 125 |
133 DISALLOW_COPY_AND_ASSIGN(OutOfDisplayDelegate); | 126 DISALLOW_COPY_AND_ASSIGN(OutOfDisplayDelegate); |
134 }; | 127 }; |
(...skipping 12 matching lines...) Expand all Loading... |
147 widget->Init(params); | 140 widget->Init(params); |
148 widget->SetBounds(gfx::Rect(450,10, 100, 100)); | 141 widget->SetBounds(gfx::Rect(450,10, 100, 100)); |
149 wm::GetWindowState(widget->GetNativeView())->set_minimum_visibility(true); | 142 wm::GetWindowState(widget->GetNativeView())->set_minimum_visibility(true); |
150 widget->Show(); | 143 widget->Show(); |
151 // Make sure the bounds is adjusted to be inside the work area. | 144 // Make sure the bounds is adjusted to be inside the work area. |
152 EXPECT_EQ("390,10 100x100", widget->GetWindowBoundsInScreen().ToString()); | 145 EXPECT_EQ("390,10 100x100", widget->GetWindowBoundsInScreen().ToString()); |
153 widget->CloseNow(); | 146 widget->CloseNow(); |
154 } | 147 } |
155 | 148 |
156 } // namespace | 149 } // namespace |
OLD | NEW |