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/hit_test.h" | 10 #include "ui/base/hit_test.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 widget_delegate_(NULL), | 159 widget_delegate_(NULL), |
160 non_client_view_(NULL), | 160 non_client_view_(NULL), |
161 dragged_view_(NULL), | 161 dragged_view_(NULL), |
162 event_stack_(), | 162 event_stack_(), |
163 ownership_(InitParams::NATIVE_WIDGET_OWNS_WIDGET), | 163 ownership_(InitParams::NATIVE_WIDGET_OWNS_WIDGET), |
164 is_secondary_widget_(true), | 164 is_secondary_widget_(true), |
165 frame_type_(FRAME_TYPE_DEFAULT), | 165 frame_type_(FRAME_TYPE_DEFAULT), |
166 disable_inactive_rendering_(false), | 166 disable_inactive_rendering_(false), |
167 widget_closed_(false), | 167 widget_closed_(false), |
168 saved_show_state_(ui::SHOW_STATE_DEFAULT), | 168 saved_show_state_(ui::SHOW_STATE_DEFAULT), |
169 minimum_size_(100, 100), | |
170 focus_on_creation_(true), | 169 focus_on_creation_(true), |
171 is_top_level_(false), | 170 is_top_level_(false), |
172 native_widget_initialized_(false), | 171 native_widget_initialized_(false), |
173 is_mouse_button_pressed_(false), | 172 is_mouse_button_pressed_(false), |
174 last_mouse_event_was_move_(false) { | 173 last_mouse_event_was_move_(false) { |
175 } | 174 } |
176 | 175 |
177 Widget::~Widget() { | 176 Widget::~Widget() { |
178 while (!event_stack_.empty()) { | 177 while (!event_stack_.empty()) { |
179 event_stack_.top()->reset(); | 178 event_stack_.top()->reset(); |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 non_client_view_->WindowClosing(); | 910 non_client_view_->WindowClosing(); |
912 widget_delegate_->WindowClosing(); | 911 widget_delegate_->WindowClosing(); |
913 } | 912 } |
914 | 913 |
915 void Widget::OnNativeWidgetDestroyed() { | 914 void Widget::OnNativeWidgetDestroyed() { |
916 widget_delegate_->DeleteDelegate(); | 915 widget_delegate_->DeleteDelegate(); |
917 widget_delegate_ = NULL; | 916 widget_delegate_ = NULL; |
918 } | 917 } |
919 | 918 |
920 gfx::Size Widget::GetMinimumSize() { | 919 gfx::Size Widget::GetMinimumSize() { |
921 return non_client_view_ ? non_client_view_->GetMinimumSize() : minimum_size_; | 920 return non_client_view_ ? non_client_view_->GetMinimumSize() : gfx::Size(); |
922 } | 921 } |
923 | 922 |
924 void Widget::OnNativeWidgetSizeChanged(const gfx::Size& new_size) { | 923 void Widget::OnNativeWidgetSizeChanged(const gfx::Size& new_size) { |
925 root_view_->SetSize(new_size); | 924 root_view_->SetSize(new_size); |
926 | 925 |
927 // Size changed notifications can fire prior to full initialization | 926 // Size changed notifications can fire prior to full initialization |
928 // i.e. during session restore. Avoid saving session state during these | 927 // i.e. during session restore. Avoid saving session state during these |
929 // startup procedures. | 928 // startup procedures. |
930 if (native_widget_initialized_) | 929 if (native_widget_initialized_) |
931 SaveWindowPlacement(); | 930 SaveWindowPlacement(); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 | 1209 |
1211 //////////////////////////////////////////////////////////////////////////////// | 1210 //////////////////////////////////////////////////////////////////////////////// |
1212 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1211 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1213 | 1212 |
1214 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1213 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1215 return this; | 1214 return this; |
1216 } | 1215 } |
1217 | 1216 |
1218 } // namespace internal | 1217 } // namespace internal |
1219 } // namespace views | 1218 } // namespace views |
OLD | NEW |