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

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

Issue 2029883002: Moves mash/wm into ash/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_static_assert
Patch Set: depend on test_wm Created 4 years, 6 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 "mash/wm/bridge/wm_root_window_controller_mus.h" 5 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
6 6
7 #include "ash/common/wm/wm_root_window_controller_observer.h" 7 #include "ash/common/wm/wm_root_window_controller_observer.h"
8 #include "ash/mus/bridge/wm_globals_mus.h"
9 #include "ash/mus/bridge/wm_shelf_mus.h"
10 #include "ash/mus/bridge/wm_window_mus.h"
11 #include "ash/mus/container_ids.h"
12 #include "ash/mus/root_window_controller.h"
8 #include "components/mus/public/cpp/window.h" 13 #include "components/mus/public/cpp/window.h"
9 #include "components/mus/public/cpp/window_property.h" 14 #include "components/mus/public/cpp/window_property.h"
10 #include "components/mus/public/cpp/window_tree_client.h" 15 #include "components/mus/public/cpp/window_tree_client.h"
11 #include "mash/wm/bridge/wm_globals_mus.h"
12 #include "mash/wm/bridge/wm_shelf_mus.h"
13 #include "mash/wm/bridge/wm_window_mus.h"
14 #include "mash/wm/container_ids.h"
15 #include "mash/wm/root_window_controller.h"
16 #include "ui/display/display.h" 16 #include "ui/display/display.h"
17 #include "ui/views/mus/native_widget_mus.h" 17 #include "ui/views/mus/native_widget_mus.h"
18 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
19 19
20 MUS_DECLARE_WINDOW_PROPERTY_TYPE(mash::wm::WmRootWindowControllerMus*); 20 MUS_DECLARE_WINDOW_PROPERTY_TYPE(ash::mus::WmRootWindowControllerMus*);
21 21
22 namespace mash { 22 namespace ash {
23 namespace wm { 23 namespace mus {
24 24
25 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(mash::wm::WmRootWindowControllerMus*, 25 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(mus::WmRootWindowControllerMus*,
26 kWmRootWindowControllerKey, 26 kWmRootWindowControllerKey,
27 nullptr); 27 nullptr);
28 28
29 WmRootWindowControllerMus::WmRootWindowControllerMus( 29 WmRootWindowControllerMus::WmRootWindowControllerMus(
30 WmGlobalsMus* globals, 30 WmGlobalsMus* globals,
31 RootWindowController* root_window_controller) 31 RootWindowController* root_window_controller)
32 : globals_(globals), root_window_controller_(root_window_controller) { 32 : globals_(globals), root_window_controller_(root_window_controller) {
33 globals_->AddRootWindowController(this); 33 globals_->AddRootWindowController(this);
34 root_window_controller_->root()->SetLocalProperty(kWmRootWindowControllerKey, 34 root_window_controller_->root()->SetLocalProperty(kWmRootWindowControllerKey,
35 this); 35 this);
36 } 36 }
37 37
38 WmRootWindowControllerMus::~WmRootWindowControllerMus() { 38 WmRootWindowControllerMus::~WmRootWindowControllerMus() {
39 globals_->RemoveRootWindowController(this); 39 globals_->RemoveRootWindowController(this);
40 } 40 }
41 41
42 // static 42 // static
43 const WmRootWindowControllerMus* WmRootWindowControllerMus::Get( 43 const WmRootWindowControllerMus* WmRootWindowControllerMus::Get(
44 const mus::Window* window) { 44 const ::mus::Window* window) {
45 if (!window) 45 if (!window)
46 return nullptr; 46 return nullptr;
47 47
48 return window->GetRoot()->GetLocalProperty(kWmRootWindowControllerKey); 48 return window->GetRoot()->GetLocalProperty(kWmRootWindowControllerKey);
49 } 49 }
50 50
51 void WmRootWindowControllerMus::NotifyFullscreenStateChange( 51 void WmRootWindowControllerMus::NotifyFullscreenStateChange(
52 bool is_fullscreen) { 52 bool is_fullscreen) {
53 FOR_EACH_OBSERVER(ash::wm::WmRootWindowControllerObserver, observers_, 53 FOR_EACH_OBSERVER(wm::WmRootWindowControllerObserver, observers_,
54 OnFullscreenStateChanged(is_fullscreen)); 54 OnFullscreenStateChanged(is_fullscreen));
55 } 55 }
56 56
57 gfx::Point WmRootWindowControllerMus::ConvertPointToScreen( 57 gfx::Point WmRootWindowControllerMus::ConvertPointToScreen(
58 const WmWindowMus* source, 58 const WmWindowMus* source,
59 const gfx::Point& point) const { 59 const gfx::Point& point) const {
60 gfx::Point point_in_root = 60 gfx::Point point_in_root =
61 source->ConvertPointToTarget(source->GetRootWindow(), point); 61 source->ConvertPointToTarget(source->GetRootWindow(), point);
62 point_in_root += GetDisplay().bounds().OffsetFromOrigin(); 62 point_in_root += GetDisplay().bounds().OffsetFromOrigin();
63 return point_in_root; 63 return point_in_root;
64 } 64 }
65 65
66 gfx::Point WmRootWindowControllerMus::ConvertPointFromScreen( 66 gfx::Point WmRootWindowControllerMus::ConvertPointFromScreen(
67 const WmWindowMus* target, 67 const WmWindowMus* target,
68 const gfx::Point& point) const { 68 const gfx::Point& point) const {
69 gfx::Point result = point; 69 gfx::Point result = point;
70 result -= GetDisplay().bounds().OffsetFromOrigin(); 70 result -= GetDisplay().bounds().OffsetFromOrigin();
71 return target->GetRootWindow()->ConvertPointToTarget(target, result); 71 return target->GetRootWindow()->ConvertPointToTarget(target, result);
72 } 72 }
73 73
74 const display::Display& WmRootWindowControllerMus::GetDisplay() const { 74 const display::Display& WmRootWindowControllerMus::GetDisplay() const {
75 return root_window_controller_->display(); 75 return root_window_controller_->display();
76 } 76 }
77 77
78 bool WmRootWindowControllerMus::HasShelf() { 78 bool WmRootWindowControllerMus::HasShelf() {
79 return GetShelf() != nullptr; 79 return GetShelf() != nullptr;
80 } 80 }
81 81
82 ash::wm::WmGlobals* WmRootWindowControllerMus::GetGlobals() { 82 wm::WmGlobals* WmRootWindowControllerMus::GetGlobals() {
83 return globals_; 83 return globals_;
84 } 84 }
85 85
86 ash::wm::WorkspaceWindowState 86 wm::WorkspaceWindowState WmRootWindowControllerMus::GetWorkspaceWindowState() {
87 WmRootWindowControllerMus::GetWorkspaceWindowState() {
88 NOTIMPLEMENTED(); 87 NOTIMPLEMENTED();
89 return ash::wm::WORKSPACE_WINDOW_STATE_DEFAULT; 88 return wm::WORKSPACE_WINDOW_STATE_DEFAULT;
90 } 89 }
91 90
92 ash::AlwaysOnTopController* 91 AlwaysOnTopController* WmRootWindowControllerMus::GetAlwaysOnTopController() {
93 WmRootWindowControllerMus::GetAlwaysOnTopController() {
94 return root_window_controller_->always_on_top_controller(); 92 return root_window_controller_->always_on_top_controller();
95 } 93 }
96 94
97 ash::wm::WmShelf* WmRootWindowControllerMus::GetShelf() { 95 wm::WmShelf* WmRootWindowControllerMus::GetShelf() {
98 return root_window_controller_->wm_shelf(); 96 return root_window_controller_->wm_shelf();
99 } 97 }
100 98
101 ash::wm::WmWindow* WmRootWindowControllerMus::GetWindow() { 99 wm::WmWindow* WmRootWindowControllerMus::GetWindow() {
102 return WmWindowMus::Get(root_window_controller_->root()); 100 return WmWindowMus::Get(root_window_controller_->root());
103 } 101 }
104 102
105 void WmRootWindowControllerMus::ConfigureWidgetInitParamsForContainer( 103 void WmRootWindowControllerMus::ConfigureWidgetInitParamsForContainer(
106 views::Widget* widget, 104 views::Widget* widget,
107 int shell_container_id, 105 int shell_container_id,
108 views::Widget::InitParams* init_params) { 106 views::Widget::InitParams* init_params) {
109 init_params->parent_mus = WmWindowMus::GetMusWindow( 107 init_params->parent_mus = WmWindowMus::GetMusWindow(
110 WmWindowMus::Get(root_window_controller_->root()) 108 WmWindowMus::Get(root_window_controller_->root())
111 ->GetChildByShellWindowId(shell_container_id)); 109 ->GetChildByShellWindowId(shell_container_id));
112 DCHECK(init_params->parent_mus); 110 DCHECK(init_params->parent_mus);
113 mus::Window* new_window = 111 ::mus::Window* new_window =
114 root_window_controller_->root()->window_tree()->NewWindow(); 112 root_window_controller_->root()->window_tree()->NewWindow();
115 WmWindowMus::Get(new_window) 113 WmWindowMus::Get(new_window)
116 ->set_widget(widget, WmWindowMus::WidgetCreationType::INTERNAL); 114 ->set_widget(widget, WmWindowMus::WidgetCreationType::INTERNAL);
117 init_params->native_widget = new views::NativeWidgetMus( 115 init_params->native_widget = new views::NativeWidgetMus(
118 widget, root_window_controller_->GetConnector(), new_window, 116 widget, root_window_controller_->GetConnector(), new_window,
119 mus::mojom::SurfaceType::DEFAULT); 117 ::mus::mojom::SurfaceType::DEFAULT);
120 } 118 }
121 119
122 ash::wm::WmWindow* WmRootWindowControllerMus::FindEventTarget( 120 wm::WmWindow* WmRootWindowControllerMus::FindEventTarget(
123 const gfx::Point& location_in_screen) { 121 const gfx::Point& location_in_screen) {
124 NOTIMPLEMENTED(); 122 NOTIMPLEMENTED();
125 return nullptr; 123 return nullptr;
126 } 124 }
127 125
128 void WmRootWindowControllerMus::AddObserver( 126 void WmRootWindowControllerMus::AddObserver(
129 ash::wm::WmRootWindowControllerObserver* observer) { 127 wm::WmRootWindowControllerObserver* observer) {
130 observers_.AddObserver(observer); 128 observers_.AddObserver(observer);
131 } 129 }
132 130
133 void WmRootWindowControllerMus::RemoveObserver( 131 void WmRootWindowControllerMus::RemoveObserver(
134 ash::wm::WmRootWindowControllerObserver* observer) { 132 wm::WmRootWindowControllerObserver* observer) {
135 observers_.RemoveObserver(observer); 133 observers_.RemoveObserver(observer);
136 } 134 }
137 135
138 } // namespace wm 136 } // namespace mus
139 } // namespace mash 137 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698