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

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

Issue 2018823002: Eliminate WindowTreeConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@connection
Patch Set: . Created 4 years, 6 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 "components/mus/public/cpp/lib/in_flight_change.h" 5 #include "components/mus/public/cpp/lib/in_flight_change.h"
6 6
7 #include "components/mus/public/cpp/lib/window_private.h" 7 #include "components/mus/public/cpp/lib/window_private.h"
8 #include "components/mus/public/cpp/lib/window_tree_client_impl.h" 8 #include "components/mus/public/cpp/window_tree_client.h"
9 #include "components/mus/public/cpp/window_tree_connection.h"
10 9
11 namespace mus { 10 namespace mus {
12 11
13 // InFlightChange ------------------------------------------------------------- 12 // InFlightChange -------------------------------------------------------------
14 13
15 InFlightChange::InFlightChange(Window* window, ChangeType type) 14 InFlightChange::InFlightChange(Window* window, ChangeType type)
16 : window_(window), change_type_(type) {} 15 : window_(window), change_type_(type) {}
17 16
18 InFlightChange::~InFlightChange() {} 17 InFlightChange::~InFlightChange() {}
19 18
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 CHECK(false); 54 CHECK(false);
56 } 55 }
57 56
58 void CrashInFlightChange::Revert() { 57 void CrashInFlightChange::Revert() {
59 CHECK(false); 58 CHECK(false);
60 } 59 }
61 60
62 // InFlightWindowChange ------------------------------------------------------- 61 // InFlightWindowChange -------------------------------------------------------
63 62
64 InFlightWindowTreeClientChange::InFlightWindowTreeClientChange( 63 InFlightWindowTreeClientChange::InFlightWindowTreeClientChange(
65 WindowTreeClientImpl* client_connection, 64 WindowTreeClient* client,
66 Window* revert_value, 65 Window* revert_value,
67 ChangeType type) 66 ChangeType type)
68 : InFlightChange(nullptr, type), 67 : InFlightChange(nullptr, type),
69 connection_(client_connection), 68 client_(client),
70 revert_window_(nullptr) { 69 revert_window_(nullptr) {
71 SetRevertWindow(revert_value); 70 SetRevertWindow(revert_value);
72 } 71 }
73 72
74 InFlightWindowTreeClientChange::~InFlightWindowTreeClientChange() { 73 InFlightWindowTreeClientChange::~InFlightWindowTreeClientChange() {
75 SetRevertWindow(nullptr); 74 SetRevertWindow(nullptr);
76 } 75 }
77 76
78 void InFlightWindowTreeClientChange::SetRevertValueFrom( 77 void InFlightWindowTreeClientChange::SetRevertValueFrom(
79 const InFlightChange& change) { 78 const InFlightChange& change) {
80 SetRevertWindow(static_cast<const InFlightWindowTreeClientChange&>(change) 79 SetRevertWindow(static_cast<const InFlightWindowTreeClientChange&>(change)
81 .revert_window_); 80 .revert_window_);
82 } 81 }
83 82
84 void InFlightWindowTreeClientChange::SetRevertWindow(Window* window) { 83 void InFlightWindowTreeClientChange::SetRevertWindow(Window* window) {
85 if (revert_window_) 84 if (revert_window_)
86 revert_window_->RemoveObserver(this); 85 revert_window_->RemoveObserver(this);
87 revert_window_ = window; 86 revert_window_ = window;
88 if (revert_window_) 87 if (revert_window_)
89 revert_window_->AddObserver(this); 88 revert_window_->AddObserver(this);
90 } 89 }
91 90
92 void InFlightWindowTreeClientChange::OnWindowDestroying(Window* window) { 91 void InFlightWindowTreeClientChange::OnWindowDestroying(Window* window) {
93 SetRevertWindow(nullptr); 92 SetRevertWindow(nullptr);
94 } 93 }
95 94
96 // InFlightCaptureChange ------------------------------------------------------ 95 // InFlightCaptureChange ------------------------------------------------------
97 96
98 InFlightCaptureChange::InFlightCaptureChange( 97 InFlightCaptureChange::InFlightCaptureChange(
99 WindowTreeClientImpl* client_connection, 98 WindowTreeClient* client, Window* revert_value)
100 Window* revert_value) 99 : InFlightWindowTreeClientChange(client,
101 : InFlightWindowTreeClientChange(client_connection,
102 revert_value, 100 revert_value,
103 ChangeType::CAPTURE) {} 101 ChangeType::CAPTURE) {}
104 102
105 InFlightCaptureChange::~InFlightCaptureChange() {} 103 InFlightCaptureChange::~InFlightCaptureChange() {}
106 104
107 void InFlightCaptureChange::Revert() { 105 void InFlightCaptureChange::Revert() {
108 connection()->LocalSetCapture(revert_window()); 106 client()->LocalSetCapture(revert_window());
109 } 107 }
110 108
111 // InFlightFocusChange -------------------------------------------------------- 109 // InFlightFocusChange --------------------------------------------------------
112 110
113 InFlightFocusChange::InFlightFocusChange( 111 InFlightFocusChange::InFlightFocusChange(
114 WindowTreeClientImpl* client_connection, 112 WindowTreeClient* client,
115 Window* revert_value) 113 Window* revert_value)
116 : InFlightWindowTreeClientChange(client_connection, 114 : InFlightWindowTreeClientChange(client,
117 revert_value, 115 revert_value,
118 ChangeType::FOCUS) {} 116 ChangeType::FOCUS) {}
119 117
120 InFlightFocusChange::~InFlightFocusChange() {} 118 InFlightFocusChange::~InFlightFocusChange() {}
121 119
122 void InFlightFocusChange::Revert() { 120 void InFlightFocusChange::Revert() {
123 connection()->LocalSetFocus(revert_window()); 121 client()->LocalSetFocus(revert_window());
124 } 122 }
125 123
126 // InFlightPropertyChange ----------------------------------------------------- 124 // InFlightPropertyChange -----------------------------------------------------
127 125
128 InFlightPropertyChange::InFlightPropertyChange( 126 InFlightPropertyChange::InFlightPropertyChange(
129 Window* window, 127 Window* window,
130 const std::string& property_name, 128 const std::string& property_name,
131 const mojo::Array<uint8_t>& revert_value) 129 const mojo::Array<uint8_t>& revert_value)
132 : InFlightChange(window, ChangeType::PROPERTY), 130 : InFlightChange(window, ChangeType::PROPERTY),
133 property_name_(property_name), 131 property_name_(property_name),
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 210
213 InFlightSetModalChange::~InFlightSetModalChange() {} 211 InFlightSetModalChange::~InFlightSetModalChange() {}
214 212
215 void InFlightSetModalChange::SetRevertValueFrom(const InFlightChange& change) {} 213 void InFlightSetModalChange::SetRevertValueFrom(const InFlightChange& change) {}
216 214
217 void InFlightSetModalChange::Revert() { 215 void InFlightSetModalChange::Revert() {
218 WindowPrivate(window()).LocalUnsetModal(); 216 WindowPrivate(window()).LocalUnsetModal();
219 } 217 }
220 218
221 } // namespace mus 219 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/public/cpp/lib/in_flight_change.h ('k') | components/mus/public/cpp/lib/scoped_window_ptr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698