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

Side by Side Diff: components/mus/test_change_tracker.cc

Issue 1340983002: Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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
« no previous file with comments | « components/mus/test_change_tracker.h ('k') | components/mus/test_server_view_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test_change_tracker.h" 5 #include "components/mus/test_change_tracker.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "components/mus/public/cpp/util.h" 9 #include "components/mus/public/cpp/util.h"
10 #include "mojo/common/common_type_converters.h" 10 #include "mojo/common/common_type_converters.h"
11 11
12 using mojo::Array; 12 using mojo::Array;
13 using mojo::Id;
14 using mojo::ViewDataPtr; 13 using mojo::ViewDataPtr;
15 using mojo::String; 14 using mojo::String;
16 15
17 namespace view_manager { 16 namespace mus {
18 17
19 std::string ViewIdToString(Id id) { 18 std::string ViewIdToString(Id id) {
20 return (id == 0) ? "null" : base::StringPrintf("%d,%d", mojo::HiWord(id), 19 return (id == 0) ? "null"
21 mojo::LoWord(id)); 20 : base::StringPrintf("%d,%d", HiWord(id), LoWord(id));
22 } 21 }
23 22
24 namespace { 23 namespace {
25 24
26 std::string RectToString(const mojo::Rect& rect) { 25 std::string RectToString(const mojo::Rect& rect) {
27 return base::StringPrintf("%d,%d %dx%d", rect.x, rect.y, rect.width, 26 return base::StringPrintf("%d,%d %dx%d", rect.x, rect.y, rect.width,
28 rect.height); 27 rect.height);
29 } 28 }
30 29
31 std::string DirectionToString(mojo::OrderDirection direction) { 30 std::string DirectionToString(mojo::OrderDirection direction) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 event_action(0), 164 event_action(0),
166 direction(mojo::ORDER_DIRECTION_ABOVE), 165 direction(mojo::ORDER_DIRECTION_ABOVE),
167 bool_value(false) {} 166 bool_value(false) {}
168 167
169 Change::~Change() {} 168 Change::~Change() {}
170 169
171 TestChangeTracker::TestChangeTracker() : delegate_(NULL) {} 170 TestChangeTracker::TestChangeTracker() : delegate_(NULL) {}
172 171
173 TestChangeTracker::~TestChangeTracker() {} 172 TestChangeTracker::~TestChangeTracker() {}
174 173
175 void TestChangeTracker::OnEmbed(mojo::ConnectionSpecificId connection_id, 174 void TestChangeTracker::OnEmbed(ConnectionSpecificId connection_id,
176 ViewDataPtr root) { 175 ViewDataPtr root) {
177 Change change; 176 Change change;
178 change.type = CHANGE_TYPE_EMBED; 177 change.type = CHANGE_TYPE_EMBED;
179 change.connection_id = connection_id; 178 change.connection_id = connection_id;
180 change.views.push_back(ViewDataToTestView(root)); 179 change.views.push_back(ViewDataToTestView(root));
181 AddChange(change); 180 AddChange(change);
182 } 181 }
183 182
184 void TestChangeTracker::OnEmbeddedAppDisconnected(Id view_id) { 183 void TestChangeTracker::OnEmbeddedAppDisconnected(Id view_id) {
185 Change change; 184 Change change;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 change.type = CHANGE_TYPE_PROPERTY_CHANGED; 281 change.type = CHANGE_TYPE_PROPERTY_CHANGED;
283 change.view_id = view_id; 282 change.view_id = view_id;
284 change.property_key = name; 283 change.property_key = name;
285 if (data.is_null()) 284 if (data.is_null())
286 change.property_value = "NULL"; 285 change.property_value = "NULL";
287 else 286 else
288 change.property_value = data.To<std::string>(); 287 change.property_value = data.To<std::string>();
289 AddChange(change); 288 AddChange(change);
290 } 289 }
291 290
292 void TestChangeTracker::OnViewFocused(mojo::Id view_id) { 291 void TestChangeTracker::OnViewFocused(Id view_id) {
293 Change change; 292 Change change;
294 change.type = CHANGE_TYPE_FOCUSED; 293 change.type = CHANGE_TYPE_FOCUSED;
295 change.view_id = view_id; 294 change.view_id = view_id;
296 AddChange(change); 295 AddChange(change);
297 } 296 }
298 297
299 void TestChangeTracker::DelegateEmbed(const String& url) { 298 void TestChangeTracker::DelegateEmbed(const String& url) {
300 Change change; 299 Change change;
301 change.type = CHANGE_TYPE_DELEGATE_EMBED; 300 change.type = CHANGE_TYPE_DELEGATE_EMBED;
302 change.embed_url = url; 301 change.embed_url = url;
(...skipping 16 matching lines...) Expand all
319 ViewIdToString(parent_id).c_str()); 318 ViewIdToString(parent_id).c_str());
320 } 319 }
321 320
322 std::string TestView::ToString2() const { 321 std::string TestView::ToString2() const {
323 return base::StringPrintf( 322 return base::StringPrintf(
324 "view=%s parent=%s visible=%s drawn=%s", ViewIdToString(view_id).c_str(), 323 "view=%s parent=%s visible=%s drawn=%s", ViewIdToString(view_id).c_str(),
325 ViewIdToString(parent_id).c_str(), visible ? "true" : "false", 324 ViewIdToString(parent_id).c_str(), visible ? "true" : "false",
326 drawn ? "true" : "false"); 325 drawn ? "true" : "false");
327 } 326 }
328 327
329 } // namespace view_manager 328 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/test_change_tracker.h ('k') | components/mus/test_server_view_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698