Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: ui/views/mus/native_widget_mus.cc

Issue 1962043002: Move Show and Hide impls from PlatformWindowMus to NativeWidgetMus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/mus/platform_window_mus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mus/native_widget_mus.h" 5 #include "ui/views/mus/native_widget_mus.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "components/mus/public/cpp/property_type_converters.h" 9 #include "components/mus/public/cpp/property_type_converters.h"
10 #include "components/mus/public/cpp/window.h" 10 #include "components/mus/public/cpp/window.h"
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 // Depending upon ownership |window_| may have been destroyed. 787 // Depending upon ownership |window_| may have been destroyed.
788 if (window_) 788 if (window_)
789 window_->Destroy(); 789 window_->Destroy();
790 } 790 }
791 791
792 void NativeWidgetMus::Show() { 792 void NativeWidgetMus::Show() {
793 ShowWithWindowState(ui::SHOW_STATE_NORMAL); 793 ShowWithWindowState(ui::SHOW_STATE_NORMAL);
794 } 794 }
795 795
796 void NativeWidgetMus::Hide() { 796 void NativeWidgetMus::Hide() {
797 if (!window_tree_host_) 797 if (!(window_ && window_tree_host_))
798 return; 798 return;
799 799
800 window_tree_host_->Hide(); 800 window_tree_host_->Hide();
801 window_->SetVisible(false);
801 GetNativeWindow()->Hide(); 802 GetNativeWindow()->Hide();
802 } 803 }
803 804
804 void NativeWidgetMus::ShowMaximizedWithBounds( 805 void NativeWidgetMus::ShowMaximizedWithBounds(
805 const gfx::Rect& restored_bounds) { 806 const gfx::Rect& restored_bounds) {
806 // NOTIMPLEMENTED(); 807 // NOTIMPLEMENTED();
807 } 808 }
808 809
809 void NativeWidgetMus::ShowWithWindowState(ui::WindowShowState state) { 810 void NativeWidgetMus::ShowWithWindowState(ui::WindowShowState state) {
810 if (!window_tree_host_) 811 if (!(window_ && window_tree_host_))
811 return; 812 return;
812 813
813 window_tree_host_->Show(); 814 window_tree_host_->Show();
815 window_->SetVisible(true);
814 GetNativeWindow()->Show(); 816 GetNativeWindow()->Show();
815 if (native_widget_delegate_->CanActivate()) { 817 if (native_widget_delegate_->CanActivate()) {
816 if (state != ui::SHOW_STATE_INACTIVE) 818 if (state != ui::SHOW_STATE_INACTIVE)
817 Activate(); 819 Activate();
818 GetWidget()->SetInitialFocus(state); 820 GetWidget()->SetInitialFocus(state);
819 } 821 }
820 } 822 }
821 823
822 bool NativeWidgetMus::IsVisible() const { 824 bool NativeWidgetMus::IsVisible() const {
823 // TODO(beng): this should probably be wired thru PlatformWindow. 825 // TODO(beng): this should probably be wired thru PlatformWindow.
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 GetWidget()->Close(); 1143 GetWidget()->Close();
1142 } 1144 }
1143 1145
1144 void NativeWidgetMus::OnMusWindowVisibilityChanging(mus::Window* window) { 1146 void NativeWidgetMus::OnMusWindowVisibilityChanging(mus::Window* window) {
1145 native_widget_delegate_->OnNativeWidgetVisibilityChanging(!window->visible()); 1147 native_widget_delegate_->OnNativeWidgetVisibilityChanging(!window->visible());
1146 } 1148 }
1147 1149
1148 void NativeWidgetMus::OnMusWindowVisibilityChanged(mus::Window* window) { 1150 void NativeWidgetMus::OnMusWindowVisibilityChanged(mus::Window* window) {
1149 if (window->visible()) { 1151 if (window->visible()) {
1150 window_tree_host_->Show(); 1152 window_tree_host_->Show();
1153 window_->SetVisible(true);
1151 GetNativeWindow()->Show(); 1154 GetNativeWindow()->Show();
1152 } else { 1155 } else {
1153 window_tree_host_->Hide(); 1156 window_tree_host_->Hide();
1157 window_->SetVisible(false);
1154 GetNativeWindow()->Hide(); 1158 GetNativeWindow()->Hide();
1155 } 1159 }
1156 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); 1160 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible());
1157 } 1161 }
1158 1162
1159 } // namespace views 1163 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/mus/platform_window_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698