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

Side by Side Diff: components/mus/public/cpp/lib/window_tree_client_impl.cc

Issue 1465803003: mus: Let clients set the cursor of their window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move code. Created 5 years 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/public/cpp/lib/window_tree_client_impl.h" 5 #include "components/mus/public/cpp/lib/window_tree_client_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/mus/common/util.h" 8 #include "components/mus/common/util.h"
9 #include "components/mus/public/cpp/lib/in_flight_change.h" 9 #include "components/mus/public/cpp/lib/in_flight_change.h"
10 #include "components/mus/public/cpp/lib/window_private.h" 10 #include "components/mus/public/cpp/lib/window_private.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // we got a connection. 215 // we got a connection.
216 DCHECK(tree_); 216 DCHECK(tree_);
217 tree_->SetFocus(window_id); 217 tree_->SetFocus(window_id);
218 } 218 }
219 219
220 void WindowTreeClientImpl::SetCanFocus(Id window_id, bool can_focus) { 220 void WindowTreeClientImpl::SetCanFocus(Id window_id, bool can_focus) {
221 DCHECK(tree_); 221 DCHECK(tree_);
222 tree_->SetCanFocus(window_id, can_focus); 222 tree_->SetCanFocus(window_id, can_focus);
223 } 223 }
224 224
225 void WindowTreeClientImpl::SetPredefinedCursor(Id window_id,
226 mus::mojom::Cursor cursor_id) {
227 DCHECK(tree_);
228
229 Window* window = GetWindowById(window_id);
230 if (!window)
231 return;
232
233 // We make an inflight change thing here.
234 const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr(
235 new InFlightPredefinedCursorChange(window, window->predefined_cursor())));
236 tree_->SetPredefinedCursor(change_id, window_id, cursor_id);
237 }
238
225 void WindowTreeClientImpl::SetVisible(Window* window, bool visible) { 239 void WindowTreeClientImpl::SetVisible(Window* window, bool visible) {
226 DCHECK(tree_); 240 DCHECK(tree_);
227 const uint32_t change_id = ScheduleInFlightChange( 241 const uint32_t change_id = ScheduleInFlightChange(
228 make_scoped_ptr(new InFlightVisibleChange(window, !visible))); 242 make_scoped_ptr(new InFlightVisibleChange(window, !visible)));
229 tree_->SetWindowVisibility(change_id, window->id(), visible); 243 tree_->SetWindowVisibility(change_id, window->id(), visible);
230 } 244 }
231 245
232 void WindowTreeClientImpl::SetProperty(Window* window, 246 void WindowTreeClientImpl::SetProperty(Window* window,
233 const std::string& name, 247 const std::string& name,
234 mojo::Array<uint8_t> data) { 248 mojo::Array<uint8_t> data) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (blurred) { 604 if (blurred) {
591 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(blurred).observers(), 605 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(blurred).observers(),
592 OnWindowFocusChanged(focused, blurred)); 606 OnWindowFocusChanged(focused, blurred));
593 } 607 }
594 if (focused) { 608 if (focused) {
595 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(focused).observers(), 609 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(focused).observers(),
596 OnWindowFocusChanged(focused, blurred)); 610 OnWindowFocusChanged(focused, blurred));
597 } 611 }
598 } 612 }
599 613
614 void WindowTreeClientImpl::OnWindowPredefinedCursorChanged(
615 Id window_id,
616 mojom::Cursor cursor) {
617 Window* window = GetWindowById(window_id);
618 if (window) {
619 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window).observers(),
sky 2015/12/03 22:01:10 You need two things here: 1. If there is an in fli
Elliot Glaysher 2015/12/03 22:32:00 Done. (I think.)
620 OnWindowPredefinedCursorChanged(window, cursor));
621 }
622 }
623
600 void WindowTreeClientImpl::OnChangeCompleted(uint32 change_id, bool success) { 624 void WindowTreeClientImpl::OnChangeCompleted(uint32 change_id, bool success) {
601 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); 625 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
602 in_flight_map_.erase(change_id); 626 in_flight_map_.erase(change_id);
603 if (!change) 627 if (!change)
604 return; 628 return;
605 629
606 if (!success) 630 if (!success)
607 change->ChangeFailed(); 631 change->ChangeFailed();
608 632
609 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change); 633 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 } 682 }
659 683
660 //////////////////////////////////////////////////////////////////////////////// 684 ////////////////////////////////////////////////////////////////////////////////
661 // WindowTreeClientImpl, private: 685 // WindowTreeClientImpl, private:
662 686
663 mojo::Callback<void(bool)> WindowTreeClientImpl::ActionCompletedCallback() { 687 mojo::Callback<void(bool)> WindowTreeClientImpl::ActionCompletedCallback() {
664 return [this](bool success) {}; 688 return [this](bool success) {};
665 } 689 }
666 690
667 } // namespace mus 691 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698