| 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/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 | 739 |
| 740 void DesktopNativeWidgetAura::Hide() { | 740 void DesktopNativeWidgetAura::Hide() { |
| 741 if (!content_window_) | 741 if (!content_window_) |
| 742 return; | 742 return; |
| 743 desktop_window_tree_host_->AsWindowTreeHost()->Hide(); | 743 desktop_window_tree_host_->AsWindowTreeHost()->Hide(); |
| 744 content_window_->Hide(); | 744 content_window_->Hide(); |
| 745 } | 745 } |
| 746 | 746 |
| 747 void DesktopNativeWidgetAura::ShowMaximizedWithBounds( | 747 void DesktopNativeWidgetAura::ShowMaximizedWithBounds( |
| 748 const gfx::Rect& restored_bounds) { | 748 const gfx::Rect& restored_bounds) { |
| 749 // IsVisible() should check the same objects here for visibility. |
| 749 if (!content_window_) | 750 if (!content_window_) |
| 750 return; | 751 return; |
| 751 desktop_window_tree_host_->ShowMaximizedWithBounds(restored_bounds); | 752 desktop_window_tree_host_->ShowMaximizedWithBounds(restored_bounds); |
| 752 content_window_->Show(); | 753 content_window_->Show(); |
| 753 } | 754 } |
| 754 | 755 |
| 755 void DesktopNativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { | 756 void DesktopNativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { |
| 757 // IsVisible() should check the same objects here for visibility. |
| 756 if (!content_window_) | 758 if (!content_window_) |
| 757 return; | 759 return; |
| 758 desktop_window_tree_host_->ShowWindowWithState(state); | 760 desktop_window_tree_host_->ShowWindowWithState(state); |
| 759 content_window_->Show(); | 761 content_window_->Show(); |
| 760 } | 762 } |
| 761 | 763 |
| 762 bool DesktopNativeWidgetAura::IsVisible() const { | 764 bool DesktopNativeWidgetAura::IsVisible() const { |
| 763 return content_window_ && desktop_window_tree_host_->IsVisible(); | 765 // The objects checked here should be the same objects changed in |
| 766 // ShowWithWindowState and ShowMaximizedWithBounds. For example, MS Windows |
| 767 // platform code might show the desktop window tree host early, meaning we |
| 768 // aren't fully visible as we haven't shown the content window. Callers may |
| 769 // short-circuit a call to show this widget if they think its already visible. |
| 770 return content_window_ && content_window_->IsVisible() && |
| 771 desktop_window_tree_host_->IsVisible(); |
| 764 } | 772 } |
| 765 | 773 |
| 766 void DesktopNativeWidgetAura::Activate() { | 774 void DesktopNativeWidgetAura::Activate() { |
| 767 if (content_window_) | 775 if (content_window_) |
| 768 desktop_window_tree_host_->Activate(); | 776 desktop_window_tree_host_->Activate(); |
| 769 } | 777 } |
| 770 | 778 |
| 771 void DesktopNativeWidgetAura::Deactivate() { | 779 void DesktopNativeWidgetAura::Deactivate() { |
| 772 if (content_window_) | 780 if (content_window_) |
| 773 desktop_window_tree_host_->Deactivate(); | 781 desktop_window_tree_host_->Deactivate(); |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 if (cursor_reference_count_ == 0) { | 1207 if (cursor_reference_count_ == 0) { |
| 1200 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1208 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 1201 // for cleaning up |cursor_manager_|. | 1209 // for cleaning up |cursor_manager_|. |
| 1202 delete cursor_manager_; | 1210 delete cursor_manager_; |
| 1203 native_cursor_manager_ = NULL; | 1211 native_cursor_manager_ = NULL; |
| 1204 cursor_manager_ = NULL; | 1212 cursor_manager_ = NULL; |
| 1205 } | 1213 } |
| 1206 } | 1214 } |
| 1207 | 1215 |
| 1208 } // namespace views | 1216 } // namespace views |
| OLD | NEW |