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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 void Widget::OnNativeWidgetCreated() { | 1019 void Widget::OnNativeWidgetCreated() { |
1020 if (is_top_level()) | 1020 if (is_top_level()) |
1021 focus_manager_.reset(FocusManagerFactory::Create(this)); | 1021 focus_manager_.reset(FocusManagerFactory::Create(this)); |
1022 | 1022 |
1023 native_widget_->SetAccessibleRole( | 1023 native_widget_->SetAccessibleRole( |
1024 widget_delegate_->GetAccessibleWindowRole()); | 1024 widget_delegate_->GetAccessibleWindowRole()); |
1025 native_widget_->SetAccessibleState( | 1025 native_widget_->SetAccessibleState( |
1026 widget_delegate_->GetAccessibleWindowState()); | 1026 widget_delegate_->GetAccessibleWindowState()); |
1027 | 1027 |
1028 native_widget_->InitModalType(widget_delegate_->GetModalType()); | 1028 native_widget_->InitModalType(widget_delegate_->GetModalType()); |
| 1029 |
| 1030 FOR_EACH_OBSERVER(WidgetObserver, observers_, OnWidgetCreated(this)); |
1029 } | 1031 } |
1030 | 1032 |
1031 void Widget::OnNativeWidgetDestroying() { | 1033 void Widget::OnNativeWidgetDestroying() { |
1032 // Tell the focus manager (if any) that root_view is being removed | 1034 // Tell the focus manager (if any) that root_view is being removed |
1033 // in case that the focused view is under this root view. | 1035 // in case that the focused view is under this root view. |
1034 if (GetFocusManager()) | 1036 if (GetFocusManager()) |
1035 GetFocusManager()->ViewRemoved(root_view_.get()); | 1037 GetFocusManager()->ViewRemoved(root_view_.get()); |
1036 FOR_EACH_OBSERVER(WidgetObserver, observers_, OnWidgetDestroying(this)); | 1038 FOR_EACH_OBSERVER(WidgetObserver, observers_, OnWidgetDestroying(this)); |
1037 if (non_client_view_) | 1039 if (non_client_view_) |
1038 non_client_view_->WindowClosing(); | 1040 non_client_view_->WindowClosing(); |
1039 widget_delegate_->WindowClosing(); | 1041 widget_delegate_->WindowClosing(); |
1040 } | 1042 } |
1041 | 1043 |
1042 void Widget::OnNativeWidgetDestroyed() { | 1044 void Widget::OnNativeWidgetDestroyed() { |
| 1045 FOR_EACH_OBSERVER(WidgetObserver, observers_, OnWidgetDestroyed(this)); |
1043 widget_delegate_->DeleteDelegate(); | 1046 widget_delegate_->DeleteDelegate(); |
1044 widget_delegate_ = NULL; | 1047 widget_delegate_ = NULL; |
1045 native_widget_destroyed_ = true; | 1048 native_widget_destroyed_ = true; |
1046 } | 1049 } |
1047 | 1050 |
1048 gfx::Size Widget::GetMinimumSize() { | 1051 gfx::Size Widget::GetMinimumSize() { |
1049 return non_client_view_ ? non_client_view_->GetMinimumSize() : gfx::Size(); | 1052 return non_client_view_ ? non_client_view_->GetMinimumSize() : gfx::Size(); |
1050 } | 1053 } |
1051 | 1054 |
1052 gfx::Size Widget::GetMaximumSize() { | 1055 gfx::Size Widget::GetMaximumSize() { |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 | 1425 |
1423 //////////////////////////////////////////////////////////////////////////////// | 1426 //////////////////////////////////////////////////////////////////////////////// |
1424 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1427 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1425 | 1428 |
1426 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1429 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1427 return this; | 1430 return this; |
1428 } | 1431 } |
1429 | 1432 |
1430 } // namespace internal | 1433 } // namespace internal |
1431 } // namespace views | 1434 } // namespace views |
OLD | NEW |