| OLD | NEW | 
|    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 "ui/aura/client/aura_constants.h" |    8 #include "ui/aura/client/aura_constants.h" | 
|    9 #include "ui/aura/client/cursor_client.h" |    9 #include "ui/aura/client/cursor_client.h" | 
|   10 #include "ui/aura/client/drag_drop_client.h" |   10 #include "ui/aura/client/drag_drop_client.h" | 
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  245                                     const Widget::InitParams& params) { |  245                                     const Widget::InitParams& params) { | 
|  246   // Needed so we don't render over the non-client area the window manager |  246   // Needed so we don't render over the non-client area the window manager | 
|  247   // renders to. |  247   // renders to. | 
|  248   content_window->layer()->SetFillsBoundsOpaquely(false); |  248   content_window->layer()->SetFillsBoundsOpaquely(false); | 
|  249   if (!params.bounds.IsEmpty()) |  249   if (!params.bounds.IsEmpty()) | 
|  250     SetBoundsInDIP(params.bounds); |  250     SetBoundsInDIP(params.bounds); | 
|  251  |  251  | 
|  252   cursor_manager_ = base::MakeUnique<wm::CursorManager>( |  252   cursor_manager_ = base::MakeUnique<wm::CursorManager>( | 
|  253       base::MakeUnique<NativeCursorManagerMus>(window())); |  253       base::MakeUnique<NativeCursorManagerMus>(window())); | 
|  254   aura::client::SetCursorClient(window(), cursor_manager_.get()); |  254   aura::client::SetCursorClient(window(), cursor_manager_.get()); | 
 |  255   InitHost(); | 
|  255 } |  256 } | 
|  256  |  257  | 
|  257 void DesktopWindowTreeHostMus::OnNativeWidgetCreated( |  258 void DesktopWindowTreeHostMus::OnNativeWidgetCreated( | 
|  258     const Widget::InitParams& params) { |  259     const Widget::InitParams& params) { | 
|  259   if (params.parent && params.parent->GetHost()) { |  260   if (params.parent && params.parent->GetHost()) { | 
|  260     parent_ = static_cast<DesktopWindowTreeHostMus*>(params.parent->GetHost()); |  261     parent_ = static_cast<DesktopWindowTreeHostMus*>(params.parent->GetHost()); | 
|  261     parent_->children_.insert(this); |  262     parent_->children_.insert(this); | 
|  262   } |  263   } | 
|  263   native_widget_delegate_->OnNativeWidgetCreated(true); |  264   native_widget_delegate_->OnNativeWidgetCreated(true); | 
|  264 } |  265 } | 
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  650   native_widget_delegate_->OnNativeWidgetVisibilityChanging(true); |  651   native_widget_delegate_->OnNativeWidgetVisibilityChanging(true); | 
|  651   // Using ui::SHOW_STATE_NORMAL matches that of DesktopWindowTreeHostX11. |  652   // Using ui::SHOW_STATE_NORMAL matches that of DesktopWindowTreeHostX11. | 
|  652   ShowWindowWithState(ui::SHOW_STATE_NORMAL); |  653   ShowWindowWithState(ui::SHOW_STATE_NORMAL); | 
|  653   WindowTreeHostMus::ShowImpl(); |  654   WindowTreeHostMus::ShowImpl(); | 
|  654   native_widget_delegate_->OnNativeWidgetVisibilityChanged(true); |  655   native_widget_delegate_->OnNativeWidgetVisibilityChanged(true); | 
|  655 } |  656 } | 
|  656  |  657  | 
|  657 void DesktopWindowTreeHostMus::HideImpl() { |  658 void DesktopWindowTreeHostMus::HideImpl() { | 
|  658   native_widget_delegate_->OnNativeWidgetVisibilityChanging(false); |  659   native_widget_delegate_->OnNativeWidgetVisibilityChanging(false); | 
|  659   WindowTreeHostMus::HideImpl(); |  660   WindowTreeHostMus::HideImpl(); | 
 |  661   window()->Hide(); | 
|  660   native_widget_delegate_->OnNativeWidgetVisibilityChanged(false); |  662   native_widget_delegate_->OnNativeWidgetVisibilityChanged(false); | 
|  661 } |  663 } | 
|  662  |  664  | 
|  663 void DesktopWindowTreeHostMus::SetBoundsInPixels( |  665 void DesktopWindowTreeHostMus::SetBoundsInPixels( | 
|  664     const gfx::Rect& bounds_in_pixels) { |  666     const gfx::Rect& bounds_in_pixels) { | 
|  665   gfx::Rect final_bounds_in_pixels = bounds_in_pixels; |  667   gfx::Rect final_bounds_in_pixels = bounds_in_pixels; | 
|  666   if (GetBoundsInPixels().size() != bounds_in_pixels.size()) { |  668   if (GetBoundsInPixels().size() != bounds_in_pixels.size()) { | 
|  667     gfx::Size size = bounds_in_pixels.size(); |  669     gfx::Size size = bounds_in_pixels.size(); | 
|  668     size.SetToMax(gfx::ConvertSizeToPixel( |  670     size.SetToMax(gfx::ConvertSizeToPixel( | 
|  669         GetScaleFactor(), native_widget_delegate_->GetMinimumSize())); |  671         GetScaleFactor(), native_widget_delegate_->GetMinimumSize())); | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  689   if (window == this->window()) { |  691   if (window == this->window()) { | 
|  690     is_active_ = true; |  692     is_active_ = true; | 
|  691     desktop_native_widget_aura_->HandleActivationChanged(true); |  693     desktop_native_widget_aura_->HandleActivationChanged(true); | 
|  692   } else if (is_active_) { |  694   } else if (is_active_) { | 
|  693     is_active_ = false; |  695     is_active_ = false; | 
|  694     desktop_native_widget_aura_->HandleActivationChanged(false); |  696     desktop_native_widget_aura_->HandleActivationChanged(false); | 
|  695   } |  697   } | 
|  696 } |  698 } | 
|  697  |  699  | 
|  698 }  // namespace views |  700 }  // namespace views | 
| OLD | NEW |