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

Side by Side Diff: services/ui/public/cpp/in_flight_change.cc

Issue 2607063002: Remove mojo::Array. (Closed)
Patch Set: Created 3 years, 11 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 "services/ui/public/cpp/in_flight_change.h" 5 #include "services/ui/public/cpp/in_flight_change.h"
6 6
7 #include "services/ui/public/cpp/window_private.h" 7 #include "services/ui/public/cpp/window_private.h"
8 #include "services/ui/public/cpp/window_tree_client.h" 8 #include "services/ui/public/cpp/window_tree_client.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 void InFlightFocusChange::Revert() { 132 void InFlightFocusChange::Revert() {
133 client()->LocalSetFocus(revert_window()); 133 client()->LocalSetFocus(revert_window());
134 } 134 }
135 135
136 // InFlightPropertyChange ----------------------------------------------------- 136 // InFlightPropertyChange -----------------------------------------------------
137 137
138 InFlightPropertyChange::InFlightPropertyChange( 138 InFlightPropertyChange::InFlightPropertyChange(
139 Window* window, 139 Window* window,
140 const std::string& property_name, 140 const std::string& property_name,
141 const mojo::Array<uint8_t>& revert_value) 141 const base::Optional<std::vector<uint8_t>>& revert_value)
142 : InFlightChange(window, ChangeType::PROPERTY), 142 : InFlightChange(window, ChangeType::PROPERTY),
143 property_name_(property_name), 143 property_name_(property_name),
144 revert_value_(revert_value.Clone()) {} 144 revert_value_(revert_value) {}
145 145
146 InFlightPropertyChange::~InFlightPropertyChange() {} 146 InFlightPropertyChange::~InFlightPropertyChange() {}
147 147
148 bool InFlightPropertyChange::Matches(const InFlightChange& change) const { 148 bool InFlightPropertyChange::Matches(const InFlightChange& change) const {
149 return static_cast<const InFlightPropertyChange&>(change).property_name_ == 149 return static_cast<const InFlightPropertyChange&>(change).property_name_ ==
150 property_name_; 150 property_name_;
151 } 151 }
152 152
153 void InFlightPropertyChange::SetRevertValueFrom(const InFlightChange& change) { 153 void InFlightPropertyChange::SetRevertValueFrom(const InFlightChange& change) {
154 revert_value_ = 154 revert_value_ =
155 static_cast<const InFlightPropertyChange&>(change).revert_value_.Clone(); 155 static_cast<const InFlightPropertyChange&>(change).revert_value_;
156 } 156 }
157 157
158 void InFlightPropertyChange::Revert() { 158 void InFlightPropertyChange::Revert() {
159 WindowPrivate(window()) 159 WindowPrivate(window()).LocalSetSharedProperty(
160 .LocalSetSharedProperty(property_name_, std::move(revert_value_)); 160 property_name_, revert_value_ ? &*revert_value_ : nullptr);
yzshen1 2017/01/06 19:38:38 nit: it seems easier to read: &revert_value_.value
Sam McNally 2017/01/09 23:15:15 Done.
161 } 161 }
162 162
163 // InFlightPredefinedCursorChange --------------------------------------------- 163 // InFlightPredefinedCursorChange ---------------------------------------------
164 164
165 InFlightPredefinedCursorChange::InFlightPredefinedCursorChange( 165 InFlightPredefinedCursorChange::InFlightPredefinedCursorChange(
166 Window* window, 166 Window* window,
167 mojom::Cursor revert_value) 167 mojom::Cursor revert_value)
168 : InFlightChange(window, ChangeType::PREDEFINED_CURSOR), 168 : InFlightChange(window, ChangeType::PREDEFINED_CURSOR),
169 revert_cursor_(revert_value) {} 169 revert_cursor_(revert_value) {}
170 170
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 222
223 InFlightSetModalChange::~InFlightSetModalChange() {} 223 InFlightSetModalChange::~InFlightSetModalChange() {}
224 224
225 void InFlightSetModalChange::SetRevertValueFrom(const InFlightChange& change) {} 225 void InFlightSetModalChange::SetRevertValueFrom(const InFlightChange& change) {}
226 226
227 void InFlightSetModalChange::Revert() { 227 void InFlightSetModalChange::Revert() {
228 WindowPrivate(window()).LocalUnsetModal(); 228 WindowPrivate(window()).LocalUnsetModal();
229 } 229 }
230 230
231 } // namespace ui 231 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698