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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: components/mus/public/cpp/lib/window_tree_client_impl.cc
diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc
index 2b094e96cdc0aa071aa8b3cd18e2d40e3d0b7f0d..b67d4b0e8ca09020ad44b2aebcd8e1188b12cdfb 100644
--- a/components/mus/public/cpp/lib/window_tree_client_impl.cc
+++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc
@@ -222,6 +222,20 @@ void WindowTreeClientImpl::SetCanFocus(Id window_id, bool can_focus) {
tree_->SetCanFocus(window_id, can_focus);
}
+void WindowTreeClientImpl::SetPredefinedCursor(Id window_id,
+ mus::mojom::Cursor cursor_id) {
+ DCHECK(tree_);
+
+ Window* window = GetWindowById(window_id);
+ if (!window)
+ return;
+
+ // We make an inflight change thing here.
+ const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr(
+ new InFlightPredefinedCursorChange(window, window->predefined_cursor())));
+ tree_->SetPredefinedCursor(change_id, window_id, cursor_id);
+}
+
void WindowTreeClientImpl::SetVisible(Window* window, bool visible) {
DCHECK(tree_);
const uint32_t change_id = ScheduleInFlightChange(
@@ -597,6 +611,16 @@ void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) {
}
}
+void WindowTreeClientImpl::OnWindowPredefinedCursorChanged(
+ Id window_id,
+ mojom::Cursor cursor) {
+ Window* window = GetWindowById(window_id);
+ if (window) {
+ 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.)
+ OnWindowPredefinedCursorChanged(window, cursor));
+ }
+}
+
void WindowTreeClientImpl::OnChangeCompleted(uint32 change_id, bool success) {
scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
in_flight_map_.erase(change_id);

Powered by Google App Engine
This is Rietveld 408576698