OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/widget.h" | 5 #include "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/l10n/l10n_font_util.h" | 10 #include "ui/base/l10n/l10n_font_util.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 | 147 |
148 Widget::~Widget() { | 148 Widget::~Widget() { |
149 while (!event_stack_.empty()) { | 149 while (!event_stack_.empty()) { |
150 event_stack_.top()->reset(); | 150 event_stack_.top()->reset(); |
151 event_stack_.pop(); | 151 event_stack_.pop(); |
152 } | 152 } |
153 | 153 |
154 DestroyRootView(); | 154 DestroyRootView(); |
155 | 155 |
156 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) | 156 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) { |
| 157 CloseNow(); |
157 delete native_widget_; | 158 delete native_widget_; |
| 159 } |
158 } | 160 } |
159 | 161 |
160 // static | 162 // static |
161 Widget* Widget::CreateWindow(WidgetDelegate* delegate) { | 163 Widget* Widget::CreateWindow(WidgetDelegate* delegate) { |
162 return CreateWindowWithParentAndBounds(delegate, NULL, gfx::Rect()); | 164 return CreateWindowWithParentAndBounds(delegate, NULL, gfx::Rect()); |
163 } | 165 } |
164 | 166 |
165 // static | 167 // static |
166 Widget* Widget::CreateWindowWithParent(WidgetDelegate* delegate, | 168 Widget* Widget::CreateWindowWithParent(WidgetDelegate* delegate, |
167 gfx::NativeWindow parent) { | 169 gfx::NativeWindow parent) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 325 } |
324 | 326 |
325 // Converted methods (see header) ---------------------------------------------- | 327 // Converted methods (see header) ---------------------------------------------- |
326 | 328 |
327 Widget* Widget::GetTopLevelWidget() { | 329 Widget* Widget::GetTopLevelWidget() { |
328 return const_cast<Widget*>( | 330 return const_cast<Widget*>( |
329 const_cast<const Widget*>(this)->GetTopLevelWidget()); | 331 const_cast<const Widget*>(this)->GetTopLevelWidget()); |
330 } | 332 } |
331 | 333 |
332 const Widget* Widget::GetTopLevelWidget() const { | 334 const Widget* Widget::GetTopLevelWidget() const { |
333 internal::NativeWidgetPrivate* native_widget = | 335 return native_widget_->GetTopLevelWidget(); |
334 internal::NativeWidgetPrivate::GetTopLevelNativeWidget(GetNativeView()); | |
335 return native_widget ? native_widget->GetWidget() : NULL; | |
336 } | 336 } |
337 | 337 |
338 void Widget::SetContentsView(View* view) { | 338 void Widget::SetContentsView(View* view) { |
339 root_view_->SetContentsView(view); | 339 root_view_->SetContentsView(view); |
340 } | 340 } |
341 | 341 |
342 gfx::Rect Widget::GetWindowScreenBounds() const { | 342 gfx::Rect Widget::GetWindowScreenBounds() const { |
343 return native_widget_->GetWindowScreenBounds(); | 343 return native_widget_->GetWindowScreenBounds(); |
344 } | 344 } |
345 | 345 |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 | 1012 |
1013 //////////////////////////////////////////////////////////////////////////////// | 1013 //////////////////////////////////////////////////////////////////////////////// |
1014 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1014 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1015 | 1015 |
1016 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1016 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1017 return this; | 1017 return this; |
1018 } | 1018 } |
1019 | 1019 |
1020 } // namespace internal | 1020 } // namespace internal |
1021 } // namespace views | 1021 } // namespace views |
OLD | NEW |