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

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

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: Created 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/platform_window_mus.h" 5 #include "ui/views/mus/platform_window_mus.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "components/mus/public/cpp/property_type_converters.h" 8 #include "components/mus/public/cpp/property_type_converters.h"
9 #include "components/mus/public/cpp/window_property.h" 9 #include "components/mus/public/cpp/window_property.h"
10 #include "components/mus/public/interfaces/window_manager.mojom.h" 10 #include "components/mus/public/interfaces/window_manager.mojom.h"
11 #include "mojo/converters/input_events/input_events_type_converters.h" 11 #include "mojo/converters/input_events/input_events_type_converters.h"
12 #include "ui/platform_window/platform_window_delegate.h" 12 #include "ui/platform_window/platform_window_delegate.h"
13 #include "ui/views/mus/window_manager_connection.h" 13 #include "ui/views/mus/window_manager_connection.h"
14 14
15 namespace views { 15 namespace views {
16 16
17 namespace { 17 namespace {
18 static uint32_t accelerated_widget_count = 1; 18 static uint32_t accelerated_widget_count = 1;
19 19
20 } // namespace 20 } // namespace
21 21
22 PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate, 22 PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate,
23 mus::Window* mus_window) 23 mus::Window* mus_window)
24 : delegate_(delegate), 24 : delegate_(delegate),
25 mus_window_(mus_window), 25 mus_window_(mus_window),
26 show_state_(mus::mojom::SHOW_STATE_RESTORED), 26 show_state_(mus::mojom::ShowState::RESTORED),
27 last_cursor_(mus::mojom::CURSOR_NULL), 27 last_cursor_(mus::mojom::Cursor::CURSOR_NULL),
28 has_capture_(false), 28 has_capture_(false),
29 mus_window_destroyed_(false) { 29 mus_window_destroyed_(false) {
30 DCHECK(delegate_); 30 DCHECK(delegate_);
31 DCHECK(mus_window_); 31 DCHECK(mus_window_);
32 mus_window_->AddObserver(this); 32 mus_window_->AddObserver(this);
33 mus_window_->set_input_event_handler(this); 33 mus_window_->set_input_event_handler(this);
34 34
35 // We need accelerated widget numbers to be different for each 35 // We need accelerated widget numbers to be different for each
36 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t 36 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t
37 // has this property. 37 // has this property.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // TODO(sky): this is wrong, need real capture api. 104 // TODO(sky): this is wrong, need real capture api.
105 has_capture_ = false; 105 has_capture_ = false;
106 NOTIMPLEMENTED(); 106 NOTIMPLEMENTED();
107 } 107 }
108 108
109 void PlatformWindowMus::ToggleFullscreen() { 109 void PlatformWindowMus::ToggleFullscreen() {
110 NOTIMPLEMENTED(); 110 NOTIMPLEMENTED();
111 } 111 }
112 112
113 void PlatformWindowMus::Maximize() { 113 void PlatformWindowMus::Maximize() {
114 SetShowState(mus::mojom::SHOW_STATE_MAXIMIZED); 114 SetShowState(mus::mojom::ShowState::MAXIMIZED);
115 } 115 }
116 116
117 void PlatformWindowMus::Minimize() { 117 void PlatformWindowMus::Minimize() {
118 SetShowState(mus::mojom::SHOW_STATE_MINIMIZED); 118 SetShowState(mus::mojom::ShowState::MINIMIZED);
119 } 119 }
120 120
121 void PlatformWindowMus::Restore() { 121 void PlatformWindowMus::Restore() {
122 SetShowState(mus::mojom::SHOW_STATE_RESTORED); 122 SetShowState(mus::mojom::ShowState::RESTORED);
123 } 123 }
124 124
125 void PlatformWindowMus::SetCursor(ui::PlatformCursor cursor) { 125 void PlatformWindowMus::SetCursor(ui::PlatformCursor cursor) {
126 NOTIMPLEMENTED(); 126 NOTIMPLEMENTED();
127 } 127 }
128 128
129 void PlatformWindowMus::MoveCursorTo(const gfx::Point& location) { 129 void PlatformWindowMus::MoveCursorTo(const gfx::Point& location) {
130 NOTIMPLEMENTED(); 130 NOTIMPLEMENTED();
131 } 131 }
132 132
133 void PlatformWindowMus::ConfineCursorToBounds(const gfx::Rect& bounds) { 133 void PlatformWindowMus::ConfineCursorToBounds(const gfx::Rect& bounds) {
134 NOTIMPLEMENTED(); 134 NOTIMPLEMENTED();
135 } 135 }
136 136
137 ui::PlatformImeController* PlatformWindowMus::GetPlatformImeController() { 137 ui::PlatformImeController* PlatformWindowMus::GetPlatformImeController() {
138 return nullptr; 138 return nullptr;
139 } 139 }
140 140
141 void PlatformWindowMus::SetShowState(mus::mojom::ShowState show_state) { 141 void PlatformWindowMus::SetShowState(mus::mojom::ShowState show_state) {
142 mus_window_->SetSharedProperty<int32_t>( 142 mus_window_->SetSharedProperty<int32_t>(
143 mus::mojom::WindowManager::kShowState_Property, show_state); 143 mus::mojom::WindowManager::kShowState_Property,
144 static_cast<int32_t>(show_state));
144 } 145 }
145 146
146 void PlatformWindowMus::OnWindowDestroyed(mus::Window* window) { 147 void PlatformWindowMus::OnWindowDestroyed(mus::Window* window) {
147 DCHECK_EQ(mus_window_, window); 148 DCHECK_EQ(mus_window_, window);
148 mus_window_destroyed_ = true; 149 mus_window_destroyed_ = true;
149 delegate_->OnClosed(); 150 delegate_->OnClosed();
150 mus_window_ = nullptr; 151 mus_window_ = nullptr;
151 } 152 }
152 153
153 void PlatformWindowMus::OnWindowBoundsChanged(mus::Window* window, 154 void PlatformWindowMus::OnWindowBoundsChanged(mus::Window* window,
(...skipping 25 matching lines...) Expand all
179 if (name != mus::mojom::WindowManager::kShowState_Property) 180 if (name != mus::mojom::WindowManager::kShowState_Property)
180 return; 181 return;
181 mus::mojom::ShowState show_state = 182 mus::mojom::ShowState show_state =
182 static_cast<mus::mojom::ShowState>(window->GetSharedProperty<int32_t>( 183 static_cast<mus::mojom::ShowState>(window->GetSharedProperty<int32_t>(
183 mus::mojom::WindowManager::kShowState_Property)); 184 mus::mojom::WindowManager::kShowState_Property));
184 if (show_state == show_state_) 185 if (show_state == show_state_)
185 return; 186 return;
186 show_state_ = show_state; 187 show_state_ = show_state;
187 ui::PlatformWindowState state = ui::PLATFORM_WINDOW_STATE_UNKNOWN; 188 ui::PlatformWindowState state = ui::PLATFORM_WINDOW_STATE_UNKNOWN;
188 switch (show_state_) { 189 switch (show_state_) {
189 case mus::mojom::SHOW_STATE_MINIMIZED: 190 case mus::mojom::ShowState::MINIMIZED:
190 state = ui::PLATFORM_WINDOW_STATE_MINIMIZED; 191 state = ui::PLATFORM_WINDOW_STATE_MINIMIZED;
191 break; 192 break;
192 case mus::mojom::SHOW_STATE_MAXIMIZED: 193 case mus::mojom::ShowState::MAXIMIZED:
193 state = ui::PLATFORM_WINDOW_STATE_MAXIMIZED; 194 state = ui::PLATFORM_WINDOW_STATE_MAXIMIZED;
194 break; 195 break;
195 case mus::mojom::SHOW_STATE_RESTORED: 196 case mus::mojom::ShowState::RESTORED:
196 state = ui::PLATFORM_WINDOW_STATE_NORMAL; 197 state = ui::PLATFORM_WINDOW_STATE_NORMAL;
197 break; 198 break;
198 case mus::mojom::SHOW_STATE_IMMERSIVE: 199 case mus::mojom::ShowState::IMMERSIVE:
199 case mus::mojom::SHOW_STATE_PRESENTATION: 200 case mus::mojom::ShowState::PRESENTATION:
200 // This may not be sufficient. 201 // This may not be sufficient.
201 state = ui::PLATFORM_WINDOW_STATE_FULLSCREEN; 202 state = ui::PLATFORM_WINDOW_STATE_FULLSCREEN;
202 break; 203 break;
203 } 204 }
204 delegate_->OnWindowStateChanged(state); 205 delegate_->OnWindowStateChanged(state);
205 } 206 }
206 207
207 void PlatformWindowMus::OnRequestClose(mus::Window* window) { 208 void PlatformWindowMus::OnRequestClose(mus::Window* window) {
208 delegate_->OnCloseRequest(); 209 delegate_->OnCloseRequest();
209 } 210 }
210 211
211 void PlatformWindowMus::OnWindowInputEvent( 212 void PlatformWindowMus::OnWindowInputEvent(
212 mus::Window* view, 213 mus::Window* view,
213 mus::mojom::EventPtr event, 214 mus::mojom::EventPtr event,
214 scoped_ptr<base::Closure>* ack_callback) { 215 scoped_ptr<base::Closure>* ack_callback) {
215 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event>>()); 216 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event>>());
216 delegate_->DispatchEvent(ui_event.get()); 217 delegate_->DispatchEvent(ui_event.get());
217 } 218 }
218 219
219 } // namespace views 220 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698