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

Side by Side Diff: components/mus/ws/window_server.cc

Issue 2060513002: Tab dragging as implemented as a mus API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: OnWmMoveLoopComplete() -> WmResponse() and use change_id instead of window_id in cancel. Created 4 years, 5 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 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 #include "components/mus/ws/window_server.h" 5 #include "components/mus/ws/window_server.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 12 matching lines...) Expand all
23 #include "components/mus/ws/window_manager_window_tree_factory.h" 23 #include "components/mus/ws/window_manager_window_tree_factory.h"
24 #include "components/mus/ws/window_server_delegate.h" 24 #include "components/mus/ws/window_server_delegate.h"
25 #include "components/mus/ws/window_tree.h" 25 #include "components/mus/ws/window_tree.h"
26 #include "components/mus/ws/window_tree_binding.h" 26 #include "components/mus/ws/window_tree_binding.h"
27 #include "services/shell/public/cpp/connection.h" 27 #include "services/shell/public/cpp/connection.h"
28 #include "ui/gfx/geometry/size_conversions.h" 28 #include "ui/gfx/geometry/size_conversions.h"
29 29
30 namespace mus { 30 namespace mus {
31 namespace ws { 31 namespace ws {
32 32
33 struct WindowServer::CurrentMoveLoopState {
34 uint32_t change_id;
35 ServerWindow* window;
36 WindowTree* initiator;
37 gfx::Rect revert_bounds;
38 };
39
33 WindowServer::WindowServer( 40 WindowServer::WindowServer(
34 WindowServerDelegate* delegate, 41 WindowServerDelegate* delegate,
35 const scoped_refptr<mus::SurfacesState>& surfaces_state) 42 const scoped_refptr<mus::SurfacesState>& surfaces_state)
36 : delegate_(delegate), 43 : delegate_(delegate),
37 surfaces_state_(surfaces_state), 44 surfaces_state_(surfaces_state),
38 next_client_id_(1), 45 next_client_id_(1),
39 display_manager_(new DisplayManager(this, &user_id_tracker_)), 46 display_manager_(new DisplayManager(this, &user_id_tracker_)),
40 current_operation_(nullptr), 47 current_operation_(nullptr),
41 in_destructor_(false), 48 in_destructor_(false),
42 next_wm_change_id_(0), 49 next_wm_change_id_(0),
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } 415 }
409 416
410 void WindowServer::SetPaintCallback( 417 void WindowServer::SetPaintCallback(
411 const base::Callback<void(ServerWindow*)>& callback) { 418 const base::Callback<void(ServerWindow*)>& callback) {
412 DCHECK(delegate_->IsTestConfig()) << "Paint callbacks are expensive, and " 419 DCHECK(delegate_->IsTestConfig()) << "Paint callbacks are expensive, and "
413 << "allowed only in tests."; 420 << "allowed only in tests.";
414 DCHECK(window_paint_callback_.is_null() || callback.is_null()); 421 DCHECK(window_paint_callback_.is_null() || callback.is_null());
415 window_paint_callback_ = callback; 422 window_paint_callback_ = callback;
416 } 423 }
417 424
425 void WindowServer::StartMoveLoop(uint32_t change_id,
426 ServerWindow* window,
427 WindowTree* initiator,
428 const gfx::Rect& revert_bounds) {
429 current_move_loop_.reset(
430 new CurrentMoveLoopState{change_id, window, initiator, revert_bounds});
431 }
432
433 void WindowServer::EndMoveLoop() {
434 current_move_loop_.reset();
435 }
436
437 uint32_t WindowServer::GetCurrentMoveLoopChangeId() {
438 if (current_move_loop_)
dcheng 2016/07/06 09:27:53 I'm not 100% sure about this, but it feels like th
439 return current_move_loop_->change_id;
440 return 0;
441 }
442
443 ServerWindow* WindowServer::GetCurrentMoveLoopWindow() {
444 if (current_move_loop_)
445 return current_move_loop_->window;
446 return nullptr;
447 }
448
449 WindowTree* WindowServer::GetCurrentMoveLoopInitiator() {
450 if (current_move_loop_)
451 return current_move_loop_->initiator;
452 return nullptr;
453 }
454
455 gfx::Rect WindowServer::GetCurrentMoveLoopRevertBounds() {
456 if (current_move_loop_)
457 return current_move_loop_->revert_bounds;
458 return gfx::Rect();
459 }
460
418 bool WindowServer::GetAndClearInFlightWindowManagerChange( 461 bool WindowServer::GetAndClearInFlightWindowManagerChange(
419 uint32_t window_manager_change_id, 462 uint32_t window_manager_change_id,
420 InFlightWindowManagerChange* change) { 463 InFlightWindowManagerChange* change) {
421 // There are valid reasons as to why we wouldn't know about the id. The 464 // There are valid reasons as to why we wouldn't know about the id. The
422 // most likely is the client disconnected before the response from the window 465 // most likely is the client disconnected before the response from the window
423 // manager came back. 466 // manager came back.
424 auto iter = in_flight_wm_change_map_.find(window_manager_change_id); 467 auto iter = in_flight_wm_change_map_.find(window_manager_change_id);
425 if (iter == in_flight_wm_change_map_.end()) 468 if (iter == in_flight_wm_change_map_.end())
426 return false; 469 return false;
427 470
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 void WindowServer::OnUserIdAdded(const UserId& id) { 741 void WindowServer::OnUserIdAdded(const UserId& id) {
699 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 742 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
700 } 743 }
701 744
702 void WindowServer::OnUserIdRemoved(const UserId& id) { 745 void WindowServer::OnUserIdRemoved(const UserId& id) {
703 activity_monitor_map_.erase(id); 746 activity_monitor_map_.erase(id);
704 } 747 }
705 748
706 } // namespace ws 749 } // namespace ws
707 } // namespace mus 750 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698