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

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

Issue 1953293004: PlatformWindowMus::SetBounds to NativeWidgetMus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop WIP testing code 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.h » ('j') | ui/views/mus/platform_window_mus.cc » ('J')
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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 return window_->GetSharedProperty<gfx::Rect>(kRestoreBounds_Property); 704 return window_->GetSharedProperty<gfx::Rect>(kRestoreBounds_Property);
705 } 705 }
706 return GetWindowBoundsInScreen(); 706 return GetWindowBoundsInScreen();
707 } 707 }
708 708
709 std::string NativeWidgetMus::GetWorkspace() const { 709 std::string NativeWidgetMus::GetWorkspace() const {
710 return std::string(); 710 return std::string();
711 } 711 }
712 712
713 void NativeWidgetMus::SetBounds(const gfx::Rect& bounds) { 713 void NativeWidgetMus::SetBounds(const gfx::Rect& bounds) {
714 if (!window_tree_host_) 714 if (!(window_ && window_tree_host_))
715 return; 715 return;
716 716
717 gfx::Size size(bounds.size()); 717 gfx::Size size(bounds.size());
718 const gfx::Size min_size = GetMinimumSize(); 718 const gfx::Size min_size = GetMinimumSize();
719 const gfx::Size max_size = GetMaximumSize(); 719 const gfx::Size max_size = GetMaximumSize();
720 if (!max_size.IsEmpty()) 720 if (!max_size.IsEmpty())
721 size.SetToMin(max_size); 721 size.SetToMin(max_size);
722 size.SetToMax(min_size); 722 size.SetToMax(min_size);
723 window_tree_host_->SetBounds(gfx::Rect(bounds.origin(), size)); 723 window_tree_host_->SetBounds(gfx::Rect(bounds.origin(), size));
724 window_->SetBounds(gfx::Rect(bounds.origin(), size));
724 } 725 }
725 726
726 void NativeWidgetMus::SetSize(const gfx::Size& size) { 727 void NativeWidgetMus::SetSize(const gfx::Size& size) {
727 if (!window_tree_host_) 728 if (!window_tree_host_)
728 return; 729 return;
729 730
730 gfx::Rect bounds = window_tree_host_->GetBounds(); 731 gfx::Rect bounds = window_tree_host_->GetBounds();
731 SetBounds(gfx::Rect(bounds.origin(), size)); 732 SetBounds(gfx::Rect(bounds.origin(), size));
732 } 733 }
733 734
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 GetWidget()->SetInitialFocus(state); 792 GetWidget()->SetInitialFocus(state);
792 } 793 }
793 } 794 }
794 795
795 bool NativeWidgetMus::IsVisible() const { 796 bool NativeWidgetMus::IsVisible() const {
796 // TODO(beng): this should probably be wired thru PlatformWindow. 797 // TODO(beng): this should probably be wired thru PlatformWindow.
797 return window_ && window_->visible(); 798 return window_ && window_->visible();
798 } 799 }
799 800
800 void NativeWidgetMus::Activate() { 801 void NativeWidgetMus::Activate() {
801 if (window_tree_host_) 802 if (window_)
802 window_tree_host_->platform_window()->Activate(); 803 window_->SetFocus();
803 } 804 }
804 805
805 void NativeWidgetMus::Deactivate() { 806 void NativeWidgetMus::Deactivate() {
806 if (IsActive()) 807 if (IsActive())
807 window_->connection()->ClearFocus(); 808 window_->connection()->ClearFocus();
808 } 809 }
809 810
810 bool NativeWidgetMus::IsActive() const { 811 bool NativeWidgetMus::IsActive() const {
811 mus::Window* focused = 812 mus::Window* focused =
812 window_ ? window_->connection()->GetFocusedWindow() : nullptr; 813 window_ ? window_->connection()->GetFocusedWindow() : nullptr;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 window_tree_host_->Show(); 1124 window_tree_host_->Show();
1124 GetNativeWindow()->Show(); 1125 GetNativeWindow()->Show();
1125 } else { 1126 } else {
1126 window_tree_host_->Hide(); 1127 window_tree_host_->Hide();
1127 GetNativeWindow()->Hide(); 1128 GetNativeWindow()->Hide();
1128 } 1129 }
1129 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); 1130 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible());
1130 } 1131 }
1131 1132
1132 } // namespace views 1133 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/mus/platform_window_mus.h » ('j') | ui/views/mus/platform_window_mus.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698