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

Side by Side Diff: ash/mus/bridge/wm_window_mus.cc

Issue 2620913003: Removes WmRootWindowController subclasses (Closed)
Patch Set: WmLookupAura::GetRootWindowControllerWithDisplayId needs to handle null Created 3 years, 11 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 "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"
11 #include "ash/common/wm_layout_manager.h" 11 #include "ash/common/wm_layout_manager.h"
12 #include "ash/common/wm_lookup.h" 12 #include "ash/common/wm_lookup.h"
13 #include "ash/common/wm_transient_window_observer.h" 13 #include "ash/common/wm_transient_window_observer.h"
14 #include "ash/common/wm_window_observer.h" 14 #include "ash/common/wm_window_observer.h"
15 #include "ash/common/wm_window_property.h" 15 #include "ash/common/wm_window_property.h"
16 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
17 #include "ash/mus/bridge/wm_shell_mus.h" 16 #include "ash/mus/bridge/wm_shell_mus.h"
18 #include "ash/mus/property_util.h" 17 #include "ash/mus/property_util.h"
18 #include "ash/mus/root_window_controller.h"
19 #include "ash/mus/window_manager.h" 19 #include "ash/mus/window_manager.h"
20 #include "ash/public/cpp/shell_window_ids.h" 20 #include "ash/public/cpp/shell_window_ids.h"
21 #include "ash/wm/window_properties.h" 21 #include "ash/wm/window_properties.h"
22 #include "services/ui/public/interfaces/window_manager.mojom.h" 22 #include "services/ui/public/interfaces/window_manager.mojom.h"
23 #include "ui/aura/client/aura_constants.h" 23 #include "ui/aura/client/aura_constants.h"
24 #include "ui/aura/mus/window_manager_delegate.h" 24 #include "ui/aura/mus/window_manager_delegate.h"
25 #include "ui/aura/mus/window_mus.h" 25 #include "ui/aura/mus/window_mus.h"
26 #include "ui/aura/mus/window_tree_client.h" 26 #include "ui/aura/mus/window_tree_client.h"
27 #include "ui/aura/window.h" 27 #include "ui/aura/window.h"
28 #include "ui/base/hit_test.h" 28 #include "ui/base/hit_test.h"
(...skipping 21 matching lines...) Expand all
50 // WmWindowMus is owned by the aura::Window. 50 // WmWindowMus is owned by the aura::Window.
51 // Unfortunately there isn't a good way to avoid the cast here. 51 // Unfortunately there isn't a good way to avoid the cast here.
52 return new WmWindowMus(const_cast<aura::Window*>(window)); 52 return new WmWindowMus(const_cast<aura::Window*>(window));
53 } 53 }
54 54
55 // static 55 // static
56 WmWindowMus* WmWindowMus::Get(views::Widget* widget) { 56 WmWindowMus* WmWindowMus::Get(views::Widget* widget) {
57 return WmWindowMus::Get(widget->GetNativeView()); 57 return WmWindowMus::Get(widget->GetNativeView());
58 } 58 }
59 59
60 const WmRootWindowControllerMus* WmWindowMus::GetRootWindowControllerMus()
61 const {
62 return WmRootWindowControllerMus::Get(aura_window()->GetRootWindow());
63 }
64
65 bool WmWindowMus::IsContainer() const { 60 bool WmWindowMus::IsContainer() const {
66 return GetShellWindowId() != kShellWindowId_Invalid; 61 return GetShellWindowId() != kShellWindowId_Invalid;
67 } 62 }
68 63
69 WmRootWindowController* WmWindowMus::GetRootWindowController() { 64 WmRootWindowController* WmWindowMus::GetRootWindowController() {
James Cook 2017/01/10 22:41:13 Could this override be eliminated in favor of WmWi
sky 2017/01/10 23:06:56 Good call. WmWindowAura's implementation works as
70 return GetRootWindowControllerMus(); 65 return RootWindowController::ForWindow(aura_window())
66 ->ash_root_window_controller()
67 ->wm_root_window_controller();
71 } 68 }
72 69
73 WmShell* WmWindowMus::GetShell() const { 70 WmShell* WmWindowMus::GetShell() const {
74 return WmShellMus::Get(); 71 return WmShellMus::Get();
75 } 72 }
76 73
77 void WmWindowMus::CloseWidget() { 74 void WmWindowMus::CloseWidget() {
78 // NOTE: in the FOR_CLIENT case there is not necessarily a widget associated 75 // NOTE: in the FOR_CLIENT case there is not necessarily a widget associated
79 // with the window. Mash only creates widgets for top level windows if mash 76 // with the window. Mash only creates widgets for top level windows if mash
80 // renders the non-client frame. 77 // renders the non-client frame.
81 if (aura_window()->GetProperty(kWidgetCreationTypeKey) == 78 if (aura_window()->GetProperty(kWidgetCreationTypeKey) ==
82 WidgetCreationType::FOR_CLIENT) { 79 WidgetCreationType::FOR_CLIENT) {
83 WmShellMus::Get()->window_manager()->window_manager_client()->RequestClose( 80 WmShellMus::Get()->window_manager()->window_manager_client()->RequestClose(
84 aura_window()); 81 aura_window());
85 } else { 82 } else {
86 WmWindowAura::CloseWidget(); 83 WmWindowAura::CloseWidget();
87 } 84 }
88 } 85 }
89 86
90 void WmWindowMus::AddLimitedPreTargetHandler(ui::EventHandler* handler) { 87 void WmWindowMus::AddLimitedPreTargetHandler(ui::EventHandler* handler) {
91 DCHECK(WmShellMus::Get()->window_tree_client()->WasCreatedByThisClient( 88 DCHECK(WmShellMus::Get()->window_tree_client()->WasCreatedByThisClient(
92 aura::WindowMus::Get(aura_window()))); 89 aura::WindowMus::Get(aura_window())));
93 WmWindowAura::AddLimitedPreTargetHandler(handler); 90 WmWindowAura::AddLimitedPreTargetHandler(handler);
94 } 91 }
95 92
96 } // namespace mus 93 } // namespace mus
97 } // namespace ash 94 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698