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

Side by Side Diff: services/ui/public/cpp/window_tree_client.h

Issue 2511883006: Mojo C++ bindings: switch services/ui/public/interfaces mojom target to use STL types. (Closed)
Patch Set: . Created 4 years, 1 month 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
« no previous file with comments | « services/ui/public/cpp/window.cc ('k') | services/ui/public/cpp/window_tree_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ 5 #ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ 6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 void ClearHitTestMask(Id window_id); 108 void ClearHitTestMask(Id window_id);
109 void SetFocus(Window* window); 109 void SetFocus(Window* window);
110 void SetCanFocus(Id window_id, bool can_focus); 110 void SetCanFocus(Id window_id, bool can_focus);
111 void SetCanAcceptDrops(Id window_id, bool can_accept_drops); 111 void SetCanAcceptDrops(Id window_id, bool can_accept_drops);
112 void SetCanAcceptEvents(Id window_id, bool can_accept_events); 112 void SetCanAcceptEvents(Id window_id, bool can_accept_events);
113 void SetPredefinedCursor(Id window_id, ui::mojom::Cursor cursor_id); 113 void SetPredefinedCursor(Id window_id, ui::mojom::Cursor cursor_id);
114 void SetVisible(Window* window, bool visible); 114 void SetVisible(Window* window, bool visible);
115 void SetOpacity(Window* window, float opacity); 115 void SetOpacity(Window* window, float opacity);
116 void SetProperty(Window* window, 116 void SetProperty(Window* window,
117 const std::string& name, 117 const std::string& name,
118 mojo::Array<uint8_t> data); 118 const base::Optional<std::vector<uint8_t>>& data);
119 void SetWindowTextInputState(Id window_id, mojo::TextInputStatePtr state); 119 void SetWindowTextInputState(Id window_id, mojo::TextInputStatePtr state);
120 void SetImeVisibility(Id window_id, 120 void SetImeVisibility(Id window_id,
121 bool visible, 121 bool visible,
122 mojo::TextInputStatePtr state); 122 mojo::TextInputStatePtr state);
123 123
124 void Embed(Id window_id, 124 void Embed(Id window_id,
125 mojom::WindowTreeClientPtr client, 125 mojom::WindowTreeClientPtr client,
126 uint32_t flags, 126 uint32_t flags,
127 const mojom::WindowTree::EmbedCallback& callback); 127 const mojom::WindowTree::EmbedCallback& callback);
128 128
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 uint32_t ScheduleInFlightChange(std::unique_ptr<InFlightChange> change); 240 uint32_t ScheduleInFlightChange(std::unique_ptr<InFlightChange> change);
241 241
242 // Returns true if there is an InFlightChange that matches |change|. If there 242 // Returns true if there is an InFlightChange that matches |change|. If there
243 // is an existing change SetRevertValueFrom() is invoked on it. Returns false 243 // is an existing change SetRevertValueFrom() is invoked on it. Returns false
244 // if there is no InFlightChange matching |change|. 244 // if there is no InFlightChange matching |change|.
245 // See InFlightChange for details on how InFlightChanges are used. 245 // See InFlightChange for details on how InFlightChanges are used.
246 bool ApplyServerChangeToExistingInFlightChange(const InFlightChange& change); 246 bool ApplyServerChangeToExistingInFlightChange(const InFlightChange& change);
247 247
248 static Id server_id(const Window* window) { return window->server_id(); } 248 static Id server_id(const Window* window) { return window->server_id(); }
249 249
250 void BuildWindowTree(const mojo::Array<mojom::WindowDataPtr>& windows, 250 void BuildWindowTree(const std::vector<mojom::WindowDataPtr>& windows,
251 Window* initial_parent); 251 Window* initial_parent);
252 252
253 Window* NewWindowImpl(NewWindowType type, 253 Window* NewWindowImpl(NewWindowType type,
254 const Window::SharedProperties* properties); 254 const Window::SharedProperties* properties);
255 255
256 // Sets the mojom::WindowTree implementation. 256 // Sets the mojom::WindowTree implementation.
257 void SetWindowTree(mojom::WindowTreePtr window_tree_ptr); 257 void SetWindowTree(mojom::WindowTreePtr window_tree_ptr);
258 258
259 // Called when the mojom::WindowTree connection is lost, deletes this. 259 // Called when the mojom::WindowTree connection is lost, deletes this.
260 void OnConnectionLost(); 260 void OnConnectionLost();
(...skipping 30 matching lines...) Expand all
291 void OnTopLevelCreated(uint32_t change_id, 291 void OnTopLevelCreated(uint32_t change_id,
292 mojom::WindowDataPtr data, 292 mojom::WindowDataPtr data,
293 int64_t display_id, 293 int64_t display_id,
294 bool drawn) override; 294 bool drawn) override;
295 void OnWindowBoundsChanged(Id window_id, 295 void OnWindowBoundsChanged(Id window_id,
296 const gfx::Rect& old_bounds, 296 const gfx::Rect& old_bounds,
297 const gfx::Rect& new_bounds) override; 297 const gfx::Rect& new_bounds) override;
298 void OnClientAreaChanged( 298 void OnClientAreaChanged(
299 uint32_t window_id, 299 uint32_t window_id,
300 const gfx::Insets& new_client_area, 300 const gfx::Insets& new_client_area,
301 mojo::Array<gfx::Rect> new_additional_client_areas) override; 301 const std::vector<gfx::Rect>& new_additional_client_areas) override;
302 void OnTransientWindowAdded(uint32_t window_id, 302 void OnTransientWindowAdded(uint32_t window_id,
303 uint32_t transient_window_id) override; 303 uint32_t transient_window_id) override;
304 void OnTransientWindowRemoved(uint32_t window_id, 304 void OnTransientWindowRemoved(uint32_t window_id,
305 uint32_t transient_window_id) override; 305 uint32_t transient_window_id) override;
306 void OnWindowHierarchyChanged( 306 void OnWindowHierarchyChanged(
307 Id window_id, 307 Id window_id,
308 Id old_parent_id, 308 Id old_parent_id,
309 Id new_parent_id, 309 Id new_parent_id,
310 mojo::Array<mojom::WindowDataPtr> windows) override; 310 std::vector<mojom::WindowDataPtr> windows) override;
311 void OnWindowReordered(Id window_id, 311 void OnWindowReordered(Id window_id,
312 Id relative_window_id, 312 Id relative_window_id,
313 mojom::OrderDirection direction) override; 313 mojom::OrderDirection direction) override;
314 void OnWindowDeleted(Id window_id) override; 314 void OnWindowDeleted(Id window_id) override;
315 void OnWindowVisibilityChanged(Id window_id, bool visible) override; 315 void OnWindowVisibilityChanged(Id window_id, bool visible) override;
316 void OnWindowOpacityChanged(Id window_id, 316 void OnWindowOpacityChanged(Id window_id,
317 float old_opacity, 317 float old_opacity,
318 float new_opacity) override; 318 float new_opacity) override;
319 void OnWindowParentDrawnStateChanged(Id window_id, bool drawn) override; 319 void OnWindowParentDrawnStateChanged(Id window_id, bool drawn) override;
320 void OnWindowSharedPropertyChanged(Id window_id, 320 void OnWindowSharedPropertyChanged(
321 const mojo::String& name, 321 Id window_id,
322 mojo::Array<uint8_t> new_data) override; 322 const std::string& name,
323 const base::Optional<std::vector<uint8_t>>& new_data) override;
323 void OnWindowInputEvent(uint32_t event_id, 324 void OnWindowInputEvent(uint32_t event_id,
324 Id window_id, 325 Id window_id,
325 std::unique_ptr<ui::Event> event, 326 std::unique_ptr<ui::Event> event,
326 bool matches_pointer_watcher) override; 327 bool matches_pointer_watcher) override;
327 void OnPointerEventObserved(std::unique_ptr<ui::Event> event, 328 void OnPointerEventObserved(std::unique_ptr<ui::Event> event,
328 uint32_t window_id) override; 329 uint32_t window_id) override;
329 void OnWindowFocused(Id focused_window_id) override; 330 void OnWindowFocused(Id focused_window_id) override;
330 void OnWindowPredefinedCursorChanged(Id window_id, 331 void OnWindowPredefinedCursorChanged(Id window_id,
331 mojom::Cursor cursor) override; 332 mojom::Cursor cursor) override;
332 void OnWindowSurfaceChanged(Id window_id, 333 void OnWindowSurfaceChanged(Id window_id,
333 const cc::SurfaceId& surface_id, 334 const cc::SurfaceId& surface_id,
334 const gfx::Size& frame_size, 335 const gfx::Size& frame_size,
335 float device_scale_factor) override; 336 float device_scale_factor) override;
336 void OnDragDropStart( 337 void OnDragDropStart(
337 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) override; 338 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data)
339 override;
338 void OnDragEnter(Id window_id, 340 void OnDragEnter(Id window_id,
339 uint32_t event_flags, 341 uint32_t event_flags,
340 const gfx::Point& position, 342 const gfx::Point& position,
341 uint32_t effect_bitmask, 343 uint32_t effect_bitmask,
342 const OnDragEnterCallback& callback) override; 344 const OnDragEnterCallback& callback) override;
343 void OnDragOver(Id window_id, 345 void OnDragOver(Id window_id,
344 uint32_t event_flags, 346 uint32_t event_flags,
345 const gfx::Point& position, 347 const gfx::Point& position,
346 uint32_t effect_bitmask, 348 uint32_t effect_bitmask,
347 const OnDragOverCallback& callback) override; 349 const OnDragOverCallback& callback) override;
(...skipping 15 matching lines...) Expand all
363 // Overridden from WindowManager: 365 // Overridden from WindowManager:
364 void OnConnect(ClientSpecificId client_id) override; 366 void OnConnect(ClientSpecificId client_id) override;
365 void WmNewDisplayAdded(const display::Display& display, 367 void WmNewDisplayAdded(const display::Display& display,
366 mojom::WindowDataPtr root_data, 368 mojom::WindowDataPtr root_data,
367 bool parent_drawn) override; 369 bool parent_drawn) override;
368 void WmDisplayRemoved(int64_t display_id) override; 370 void WmDisplayRemoved(int64_t display_id) override;
369 void WmDisplayModified(const display::Display& display) override; 371 void WmDisplayModified(const display::Display& display) override;
370 void WmSetBounds(uint32_t change_id, 372 void WmSetBounds(uint32_t change_id,
371 Id window_id, 373 Id window_id,
372 const gfx::Rect& transit_bounds) override; 374 const gfx::Rect& transit_bounds) override;
373 void WmSetProperty(uint32_t change_id, 375 void WmSetProperty(
374 Id window_id, 376 uint32_t change_id,
375 const mojo::String& name, 377 Id window_id,
376 mojo::Array<uint8_t> transit_data) override; 378 const std::string& name,
377 void WmCreateTopLevelWindow(uint32_t change_id, 379 const base::Optional<std::vector<uint8_t>>& transit_data) override;
378 ClientSpecificId requesting_client_id, 380 void WmCreateTopLevelWindow(
379 mojo::Map<mojo::String, mojo::Array<uint8_t>> 381 uint32_t change_id,
380 transport_properties) override; 382 ClientSpecificId requesting_client_id,
383 const std::unordered_map<std::string, std::vector<uint8_t>>&
384 transport_properties) override;
381 void WmClientJankinessChanged(ClientSpecificId client_id, 385 void WmClientJankinessChanged(ClientSpecificId client_id,
382 bool janky) override; 386 bool janky) override;
383 void WmPerformMoveLoop(uint32_t change_id, 387 void WmPerformMoveLoop(uint32_t change_id,
384 Id window_id, 388 Id window_id,
385 mojom::MoveLoopSource source, 389 mojom::MoveLoopSource source,
386 const gfx::Point& cursor_location) override; 390 const gfx::Point& cursor_location) override;
387 void WmCancelMoveLoop(uint32_t window_id) override; 391 void WmCancelMoveLoop(uint32_t window_id) override;
388 void OnAccelerator(uint32_t ack_id, 392 void OnAccelerator(uint32_t ack_id,
389 uint32_t accelerator_id, 393 uint32_t accelerator_id,
390 std::unique_ptr<ui::Event> event) override; 394 std::unique_ptr<ui::Event> event) override;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 463
460 bool has_pointer_watcher_ = false; 464 bool has_pointer_watcher_ = false;
461 465
462 // The current change id for the client. 466 // The current change id for the client.
463 uint32_t current_move_loop_change_ = 0u; 467 uint32_t current_move_loop_change_ = 0u;
464 468
465 // Callback executed when a move loop initiated by PerformWindowMove() is 469 // Callback executed when a move loop initiated by PerformWindowMove() is
466 // completed. 470 // completed.
467 base::Callback<void(bool)> on_current_move_finished_; 471 base::Callback<void(bool)> on_current_move_finished_;
468 472
469 // The current change id for the window manager. 473 // The current change id for the window manager.gg
470 uint32_t current_wm_move_loop_change_ = 0u; 474 uint32_t current_wm_move_loop_change_ = 0u;
471 Id current_wm_move_loop_window_id_ = 0u; 475 Id current_wm_move_loop_window_id_ = 0u;
472 476
473 // State related to being the initiator of a drag started with 477 // State related to being the initiator of a drag started with
474 // PerformDragDrop(). 478 // PerformDragDrop().
475 std::unique_ptr<CurrentDragState> current_drag_state_; 479 std::unique_ptr<CurrentDragState> current_drag_state_;
476 480
477 // The mus server sends the mime drag data once per connection; we cache this 481 // The mus server sends the mime drag data once per connection; we cache this
478 // and are responsible for sending it to all of our windows. 482 // and are responsible for sending it to all of our windows.
479 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_drag_data_; 483
484 std::map<std::string, std::vector<uint8_t>> mime_drag_data_;
480 485
481 // A set of window ids for windows that we received an OnDragEnter() message 486 // A set of window ids for windows that we received an OnDragEnter() message
482 // for. We maintain this set so we know who to send OnDragFinish() messages 487 // for. We maintain this set so we know who to send OnDragFinish() messages
483 // at the end of the drag. 488 // at the end of the drag.
484 std::set<Id> drag_entered_windows_; 489 std::set<Id> drag_entered_windows_;
485 490
486 base::WeakPtrFactory<WindowTreeClient> weak_factory_; 491 base::WeakPtrFactory<WindowTreeClient> weak_factory_;
487 492
488 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); 493 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient);
489 }; 494 };
490 495
491 } // namespace ui 496 } // namespace ui
492 497
493 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ 498 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
OLDNEW
« no previous file with comments | « services/ui/public/cpp/window.cc ('k') | services/ui/public/cpp/window_tree_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698