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 "ui/views/test/child_modal_window.h" | 5 #include "ui/views/test/child_modal_window.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" // ASCIIToUTF16 | 7 #include "base/utf_string_conversions.h" // ASCIIToUTF16 |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 bool ChildModalParent::CanResize() const { | 166 bool ChildModalParent::CanResize() const { |
167 return false; | 167 return false; |
168 } | 168 } |
169 | 169 |
170 void ChildModalParent::DeleteDelegate() { | 170 void ChildModalParent::DeleteDelegate() { |
171 if (child_) { | 171 if (child_) { |
172 child_->RemoveObserver(this); | 172 child_->RemoveObserver(this); |
173 child_->Close(); | 173 child_->Close(); |
174 child_ = NULL; | 174 child_ = NULL; |
175 } | 175 } |
| 176 |
| 177 delete this; |
176 } | 178 } |
177 | 179 |
178 void ChildModalParent::Layout() { | 180 void ChildModalParent::Layout() { |
179 int running_y = y(); | 181 int running_y = y(); |
180 button_->SetBounds(x(), running_y, width(), kButtonHeight); | 182 button_->SetBounds(x(), running_y, width(), kButtonHeight); |
181 running_y += kButtonHeight; | 183 running_y += kButtonHeight; |
182 textfield_->SetBounds(x(), running_y, width(), kTextfieldHeight); | 184 textfield_->SetBounds(x(), running_y, width(), kTextfieldHeight); |
183 running_y += kTextfieldHeight; | 185 running_y += kTextfieldHeight; |
184 host_->SetBounds(x(), running_y, width(), height() - running_y); | 186 host_->SetBounds(x(), running_y, width(), height() - running_y); |
185 } | 187 } |
(...skipping 21 matching lines...) Expand all Loading... |
207 | 209 |
208 void ChildModalParent::OnWidgetClosing(Widget* widget) { | 210 void ChildModalParent::OnWidgetClosing(Widget* widget) { |
209 if (child_) { | 211 if (child_) { |
210 DCHECK_EQ(child_, widget); | 212 DCHECK_EQ(child_, widget); |
211 child_ = NULL; | 213 child_ = NULL; |
212 } | 214 } |
213 } | 215 } |
214 | 216 |
215 } // namespace test | 217 } // namespace test |
216 } // namespace views | 218 } // namespace views |
OLD | NEW |