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

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

Issue 2655513002: mash: Relay some Chrome aura window properties to Ash. (Closed)
Patch Set: More cleanup. Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/desktop_window_tree_host_mus.h" 5 #include "ui/views/mus/desktop_window_tree_host_mus.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/cursor_client.h" 10 #include "ui/aura/client/cursor_client.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 const std::map<std::string, std::vector<uint8_t>>* mus_properties) 175 const std::map<std::string, std::vector<uint8_t>>* mus_properties)
176 : aura::WindowTreeHostMus(MusClient::Get()->window_tree_client(), 176 : aura::WindowTreeHostMus(MusClient::Get()->window_tree_client(),
177 mus_properties), 177 mus_properties),
178 native_widget_delegate_(native_widget_delegate), 178 native_widget_delegate_(native_widget_delegate),
179 desktop_native_widget_aura_(desktop_native_widget_aura), 179 desktop_native_widget_aura_(desktop_native_widget_aura),
180 fullscreen_restore_state_(ui::SHOW_STATE_DEFAULT), 180 fullscreen_restore_state_(ui::SHOW_STATE_DEFAULT),
181 close_widget_factory_(this) { 181 close_widget_factory_(this) {
182 aura::Env::GetInstance()->AddObserver(this); 182 aura::Env::GetInstance()->AddObserver(this);
183 MusClient::Get()->AddObserver(this); 183 MusClient::Get()->AddObserver(this);
184 native_widget_delegate_->AsWidget()->AddObserver(this); 184 native_widget_delegate_->AsWidget()->AddObserver(this);
185 desktop_native_widget_aura->content_window()->AddObserver(this);
sky 2017/01/27 16:20:20 You never remove this observer.
msw 2017/01/27 19:11:34 Now done in the destructor.
185 // DesktopNativeWidgetAura registers the association between |content_window_| 186 // DesktopNativeWidgetAura registers the association between |content_window_|
186 // and Widget, but code may also want to go from the root (window()) to the 187 // and Widget, but code may also want to go from the root (window()) to the
187 // Widget. This call enables that. 188 // Widget. This call enables that.
188 NativeWidgetAura::RegisterNativeWidgetForWindow(desktop_native_widget_aura, 189 NativeWidgetAura::RegisterNativeWidgetForWindow(desktop_native_widget_aura,
189 window()); 190 window());
190 // TODO: use display id and bounds if available, likely need to pass in 191 // TODO: use display id and bounds if available, likely need to pass in
191 // InitParams for that. 192 // InitParams for that.
192 } 193 }
193 194
194 DesktopWindowTreeHostMus::~DesktopWindowTreeHostMus() { 195 DesktopWindowTreeHostMus::~DesktopWindowTreeHostMus() {
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 native_widget_delegate_->AsWidget()->non_client_view(); 673 native_widget_delegate_->AsWidget()->non_client_view();
673 if (non_client_view) { 674 if (non_client_view) {
674 non_client_view->Layout(); 675 non_client_view->Layout();
675 non_client_view->SchedulePaint(); 676 non_client_view->SchedulePaint();
676 } 677 }
677 678
678 SendClientAreaToServer(); 679 SendClientAreaToServer();
679 SendHitTestMaskToServer(); 680 SendHitTestMaskToServer();
680 } 681 }
681 682
683 void DesktopWindowTreeHostMus::OnWindowPropertyChanged(aura::Window* window,
684 const void* key) {
685 // Ignore this; window property changes are handled elsewhere.
686 }
687
682 void DesktopWindowTreeHostMus::OnWidgetActivationChanged(Widget* widget, 688 void DesktopWindowTreeHostMus::OnWidgetActivationChanged(Widget* widget,
683 bool active) { 689 bool active) {
684 // TODO(erg): Theoretically, this shouldn't be necessary. We should be able 690 // TODO(erg): Theoretically, this shouldn't be necessary. We should be able
685 // to just set |is_active_| in OnNativeWidgetActivationChanged() above, 691 // to just set |is_active_| in OnNativeWidgetActivationChanged() above,
686 // instead of asking the Widget to change the activation and have the widget 692 // instead of asking the Widget to change the activation and have the widget
687 // then tell us the activation has changed. But if we do that, focus breaks. 693 // then tell us the activation has changed. But if we do that, focus breaks.
688 is_active_ = active; 694 is_active_ = active;
689 } 695 }
690 696
697 void DesktopWindowTreeHostMus::OnWindowPropertyChanged(aura::Window* window,
698 const void* key,
699 intptr_t old) {
700 MusClient::Get()->OnWindowPropertyChanged(window, key);
sky 2017/01/27 16:20:20 I recommend something like this: MusClient::Get()
msw 2017/01/27 19:11:34 I tried to adopt your suggestions, let me know wha
701 }
702
691 void DesktopWindowTreeHostMus::ShowImpl() { 703 void DesktopWindowTreeHostMus::ShowImpl() {
692 native_widget_delegate_->OnNativeWidgetVisibilityChanging(true); 704 native_widget_delegate_->OnNativeWidgetVisibilityChanging(true);
693 // Using ui::SHOW_STATE_NORMAL matches that of DesktopWindowTreeHostX11. 705 // Using ui::SHOW_STATE_NORMAL matches that of DesktopWindowTreeHostX11.
694 ShowWindowWithState(ui::SHOW_STATE_NORMAL); 706 ShowWindowWithState(ui::SHOW_STATE_NORMAL);
695 WindowTreeHostMus::ShowImpl(); 707 WindowTreeHostMus::ShowImpl();
696 native_widget_delegate_->OnNativeWidgetVisibilityChanged(true); 708 native_widget_delegate_->OnNativeWidgetVisibilityChanged(true);
697 } 709 }
698 710
699 void DesktopWindowTreeHostMus::HideImpl() { 711 void DesktopWindowTreeHostMus::HideImpl() {
700 native_widget_delegate_->OnNativeWidgetVisibilityChanging(false); 712 native_widget_delegate_->OnNativeWidgetVisibilityChanging(false);
(...skipping 29 matching lines...) Expand all
730 aura::client::FocusClient* focus_client, 742 aura::client::FocusClient* focus_client,
731 aura::Window* window) { 743 aura::Window* window) {
732 if (window == this->window()) { 744 if (window == this->window()) {
733 desktop_native_widget_aura_->HandleActivationChanged(true); 745 desktop_native_widget_aura_->HandleActivationChanged(true);
734 } else if (is_active_) { 746 } else if (is_active_) {
735 desktop_native_widget_aura_->HandleActivationChanged(false); 747 desktop_native_widget_aura_->HandleActivationChanged(false);
736 } 748 }
737 } 749 }
738 750
739 } // namespace views 751 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698