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/widget/widget.h" | 5 #include "ui/views/widget/widget.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/events/event.h" | 10 #include "ui/base/events/event.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 delete native_widget_; | 214 delete native_widget_; |
215 } else { | 215 } else { |
216 DCHECK(native_widget_destroyed_) | 216 DCHECK(native_widget_destroyed_) |
217 << "Destroying a widget with a live native widget. " | 217 << "Destroying a widget with a live native widget. " |
218 << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership."; | 218 << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership."; |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 // static | 222 // static |
223 Widget* Widget::CreateWindow(WidgetDelegate* delegate) { | 223 Widget* Widget::CreateWindow(WidgetDelegate* delegate) { |
| 224 return CreateWindowWithBounds(delegate, gfx::Rect()); |
| 225 } |
| 226 |
| 227 // static |
| 228 Widget* Widget::CreateWindowWithBounds(WidgetDelegate* delegate, |
| 229 const gfx::Rect& bounds) { |
224 Widget* widget = new Widget; | 230 Widget* widget = new Widget; |
225 Widget::InitParams params; | 231 Widget::InitParams params; |
| 232 params.bounds = bounds; |
226 params.delegate = delegate; | 233 params.delegate = delegate; |
227 params.top_level = true; | 234 params.top_level = true; |
228 widget->Init(params); | 235 widget->Init(params); |
229 return widget; | 236 return widget; |
230 } | 237 } |
231 | 238 |
232 // static | 239 // static |
233 Widget* Widget::CreateWindowWithBounds(WidgetDelegate* delegate, | |
234 const gfx::Rect& bounds) { | |
235 return CreateWindowWithParentAndBounds(delegate, NULL, bounds); | |
236 } | |
237 | |
238 // static | |
239 Widget* Widget::CreateWindowWithParent(WidgetDelegate* delegate, | 240 Widget* Widget::CreateWindowWithParent(WidgetDelegate* delegate, |
240 gfx::NativeWindow parent) { | 241 gfx::NativeWindow parent) { |
241 return CreateWindowWithParentAndBounds(delegate, parent, gfx::Rect()); | 242 return CreateWindowWithParentAndBounds(delegate, parent, gfx::Rect()); |
242 } | 243 } |
243 | 244 |
244 // static | 245 // static |
245 Widget* Widget::CreateWindowWithParentAndBounds(WidgetDelegate* delegate, | 246 Widget* Widget::CreateWindowWithParentAndBounds(WidgetDelegate* delegate, |
246 gfx::NativeWindow parent, | 247 gfx::NativeWindow parent, |
247 const gfx::Rect& bounds) { | 248 const gfx::Rect& bounds) { |
248 Widget* widget = new Widget; | 249 Widget* widget = new Widget; |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 | 1389 |
1389 //////////////////////////////////////////////////////////////////////////////// | 1390 //////////////////////////////////////////////////////////////////////////////// |
1390 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1391 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1391 | 1392 |
1392 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1393 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1393 return this; | 1394 return this; |
1394 } | 1395 } |
1395 | 1396 |
1396 } // namespace internal | 1397 } // namespace internal |
1397 } // namespace views | 1398 } // namespace views |
OLD | NEW |