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 "ash/mus/bridge/wm_window_mus.h" | 5 #include "ash/mus/bridge/wm_window_mus.h" |
6 | 6 |
7 #include "ash/common/shelf/shelf_item_types.h" | 7 #include "ash/common/shelf/shelf_item_types.h" |
8 #include "ash/common/wm/container_finder.h" | 8 #include "ash/common/wm/container_finder.h" |
9 #include "ash/common/wm/window_positioning_utils.h" | 9 #include "ash/common/wm/window_positioning_utils.h" |
10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 WmRootWindowController* WmWindowMus::GetRootWindowController() { | 69 WmRootWindowController* WmWindowMus::GetRootWindowController() { |
70 return GetRootWindowControllerMus(); | 70 return GetRootWindowControllerMus(); |
71 } | 71 } |
72 | 72 |
73 WmShell* WmWindowMus::GetShell() const { | 73 WmShell* WmWindowMus::GetShell() const { |
74 return WmShellMus::Get(); | 74 return WmShellMus::Get(); |
75 } | 75 } |
76 | 76 |
77 void WmWindowMus::CloseWidget() { | 77 void WmWindowMus::CloseWidget() { |
78 views::Widget* widget = views::Widget::GetWidgetForNativeView(aura_window()); | 78 // NOTE: in the FOR_CLIENT case there is not necessarily a widget associated |
79 DCHECK(widget); | 79 // with the window. Mash only creates widgets for top level windows if mash |
80 // Allow the client to service the close request for remote widgets. | 80 // renders the non-client frame. |
81 if (aura_window()->GetProperty(kWidgetCreationTypeKey) == | 81 if (aura_window()->GetProperty(kWidgetCreationTypeKey) == |
82 WidgetCreationType::FOR_CLIENT) { | 82 WidgetCreationType::FOR_CLIENT) { |
83 WmShellMus::Get()->window_manager()->window_manager_client()->RequestClose( | 83 WmShellMus::Get()->window_manager()->window_manager_client()->RequestClose( |
84 aura_window()); | 84 aura_window()); |
85 } else { | 85 } else { |
86 widget->Close(); | 86 WmWindowAura::CloseWidget(); |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 void WmWindowMus::AddLimitedPreTargetHandler(ui::EventHandler* handler) { | 90 void WmWindowMus::AddLimitedPreTargetHandler(ui::EventHandler* handler) { |
91 DCHECK(WmShellMus::Get()->window_tree_client()->WasCreatedByThisClient( | 91 DCHECK(WmShellMus::Get()->window_tree_client()->WasCreatedByThisClient( |
92 aura::WindowMus::Get(aura_window()))); | 92 aura::WindowMus::Get(aura_window()))); |
93 WmWindowAura::AddLimitedPreTargetHandler(handler); | 93 WmWindowAura::AddLimitedPreTargetHandler(handler); |
94 } | 94 } |
95 | 95 |
96 } // namespace mus | 96 } // namespace mus |
97 } // namespace ash | 97 } // namespace ash |
OLD | NEW |