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) { | |
230 Widget* widget = new Widget; | 224 Widget* widget = new Widget; |
231 Widget::InitParams params; | 225 Widget::InitParams params; |
232 params.bounds = bounds; | |
233 params.delegate = delegate; | 226 params.delegate = delegate; |
234 params.top_level = true; | 227 params.top_level = true; |
235 widget->Init(params); | 228 widget->Init(params); |
236 return widget; | 229 return widget; |
237 } | 230 } |
238 | 231 |
239 // static | 232 // static |
| 233 Widget* Widget::CreateWindowWithBounds(WidgetDelegate* delegate, |
| 234 const gfx::Rect& bounds) { |
| 235 return CreateWindowWithParentAndBounds(delegate, NULL, bounds); |
| 236 } |
| 237 |
| 238 // static |
240 Widget* Widget::CreateWindowWithParent(WidgetDelegate* delegate, | 239 Widget* Widget::CreateWindowWithParent(WidgetDelegate* delegate, |
241 gfx::NativeWindow parent) { | 240 gfx::NativeWindow parent) { |
242 return CreateWindowWithParentAndBounds(delegate, parent, gfx::Rect()); | 241 return CreateWindowWithParentAndBounds(delegate, parent, gfx::Rect()); |
243 } | 242 } |
244 | 243 |
245 // static | 244 // static |
246 Widget* Widget::CreateWindowWithParentAndBounds(WidgetDelegate* delegate, | 245 Widget* Widget::CreateWindowWithParentAndBounds(WidgetDelegate* delegate, |
247 gfx::NativeWindow parent, | 246 gfx::NativeWindow parent, |
248 const gfx::Rect& bounds) { | 247 const gfx::Rect& bounds) { |
249 Widget* widget = new Widget; | 248 Widget* widget = new Widget; |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 | 1405 |
1407 //////////////////////////////////////////////////////////////////////////////// | 1406 //////////////////////////////////////////////////////////////////////////////// |
1408 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1407 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1409 | 1408 |
1410 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1409 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1411 return this; | 1410 return this; |
1412 } | 1411 } |
1413 | 1412 |
1414 } // namespace internal | 1413 } // namespace internal |
1415 } // namespace views | 1414 } // namespace views |
OLD | NEW |