| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 527 |
| 528 void Widget::Deactivate() { | 528 void Widget::Deactivate() { |
| 529 native_widget_->Deactivate(); | 529 native_widget_->Deactivate(); |
| 530 } | 530 } |
| 531 | 531 |
| 532 bool Widget::IsActive() const { | 532 bool Widget::IsActive() const { |
| 533 return native_widget_->IsActive(); | 533 return native_widget_->IsActive(); |
| 534 } | 534 } |
| 535 | 535 |
| 536 void Widget::DisableInactiveRendering() { | 536 void Widget::DisableInactiveRendering() { |
| 537 disable_inactive_rendering_ = true; | 537 SetInactiveRenderingDisabled(true); |
| 538 if (non_client_view_) | |
| 539 non_client_view_->DisableInactiveRendering(disable_inactive_rendering_); | |
| 540 } | 538 } |
| 541 | 539 |
| 542 void Widget::SetAlwaysOnTop(bool on_top) { | 540 void Widget::SetAlwaysOnTop(bool on_top) { |
| 543 native_widget_->SetAlwaysOnTop(on_top); | 541 native_widget_->SetAlwaysOnTop(on_top); |
| 544 } | 542 } |
| 545 | 543 |
| 546 void Widget::Maximize() { | 544 void Widget::Maximize() { |
| 547 native_widget_->Maximize(); | 545 native_widget_->Maximize(); |
| 548 } | 546 } |
| 549 | 547 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 | 840 |
| 843 bool Widget::CanActivate() const { | 841 bool Widget::CanActivate() const { |
| 844 return widget_delegate_->CanActivate(); | 842 return widget_delegate_->CanActivate(); |
| 845 } | 843 } |
| 846 | 844 |
| 847 bool Widget::IsInactiveRenderingDisabled() const { | 845 bool Widget::IsInactiveRenderingDisabled() const { |
| 848 return disable_inactive_rendering_; | 846 return disable_inactive_rendering_; |
| 849 } | 847 } |
| 850 | 848 |
| 851 void Widget::EnableInactiveRendering() { | 849 void Widget::EnableInactiveRendering() { |
| 852 disable_inactive_rendering_ = false; | 850 SetInactiveRenderingDisabled(false); |
| 853 if (non_client_view_) | |
| 854 non_client_view_->DisableInactiveRendering(false); | |
| 855 } | 851 } |
| 856 | 852 |
| 857 void Widget::OnNativeWidgetActivationChanged(bool active) { | 853 void Widget::OnNativeWidgetActivationChanged(bool active) { |
| 858 if (!active) { | 854 if (!active) { |
| 859 SaveWindowPlacement(); | 855 SaveWindowPlacement(); |
| 860 | 856 |
| 861 // Close any open menus. | 857 // Close any open menus. |
| 862 MenuController* menu_controller = MenuController::GetActiveInstance(); | 858 MenuController* menu_controller = MenuController::GetActiveInstance(); |
| 863 if (menu_controller) | 859 if (menu_controller) |
| 864 menu_controller->OnWidgetActivationChanged(); | 860 menu_controller->OnWidgetActivationChanged(); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 MessageLoop::current()->DeleteSoon(FROM_HERE, focus_manager); | 1102 MessageLoop::current()->DeleteSoon(FROM_HERE, focus_manager); |
| 1107 } | 1103 } |
| 1108 | 1104 |
| 1109 //////////////////////////////////////////////////////////////////////////////// | 1105 //////////////////////////////////////////////////////////////////////////////// |
| 1110 // Widget, private: | 1106 // Widget, private: |
| 1111 | 1107 |
| 1112 bool Widget::ShouldReleaseCaptureOnMouseReleased() const { | 1108 bool Widget::ShouldReleaseCaptureOnMouseReleased() const { |
| 1113 return true; | 1109 return true; |
| 1114 } | 1110 } |
| 1115 | 1111 |
| 1112 void Widget::SetInactiveRenderingDisabled(bool value) { |
| 1113 if (value == disable_inactive_rendering_) |
| 1114 return; |
| 1115 |
| 1116 disable_inactive_rendering_ = value; |
| 1117 if (non_client_view_) |
| 1118 non_client_view_->SetInactiveRenderingDisabled(value); |
| 1119 native_widget_->SetInactiveRenderingDisabled(value); |
| 1120 } |
| 1121 |
| 1116 void Widget::SaveWindowPlacement() { | 1122 void Widget::SaveWindowPlacement() { |
| 1117 // The window delegate does the actual saving for us. It seems like (judging | 1123 // The window delegate does the actual saving for us. It seems like (judging |
| 1118 // by go/crash) that in some circumstances we can end up here after | 1124 // by go/crash) that in some circumstances we can end up here after |
| 1119 // WM_DESTROY, at which point the window delegate is likely gone. So just | 1125 // WM_DESTROY, at which point the window delegate is likely gone. So just |
| 1120 // bail. | 1126 // bail. |
| 1121 if (!widget_delegate_) | 1127 if (!widget_delegate_) |
| 1122 return; | 1128 return; |
| 1123 | 1129 |
| 1124 ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; | 1130 ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; |
| 1125 gfx::Rect bounds; | 1131 gfx::Rect bounds; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 | 1199 |
| 1194 //////////////////////////////////////////////////////////////////////////////// | 1200 //////////////////////////////////////////////////////////////////////////////// |
| 1195 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1201 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1196 | 1202 |
| 1197 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1203 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1198 return this; | 1204 return this; |
| 1199 } | 1205 } |
| 1200 | 1206 |
| 1201 } // namespace internal | 1207 } // namespace internal |
| 1202 } // namespace views | 1208 } // namespace views |
| OLD | NEW |