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

Unified Diff: mojo/ui/associates/resolved_hits.cc

Issue 1778593003: Mozart: Add helpers for building view associates. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-6
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/ui/associates/resolved_hits.h ('k') | mojo/ui/associates/test_helpers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/ui/associates/resolved_hits.cc
diff --git a/mojo/ui/associates/resolved_hits.cc b/mojo/ui/associates/resolved_hits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..926ccad58a8ee89184b86050cf8771b706fc9edc
--- /dev/null
+++ b/mojo/ui/associates/resolved_hits.cc
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/ui/associates/resolved_hits.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "mojo/services/gfx/composition/cpp/formatting.h"
+#include "mojo/services/ui/views/cpp/formatting.h"
+
+namespace mojo {
+namespace ui {
+
+ResolvedHits::ResolvedHits(mojo::gfx::composition::HitTestResultPtr result)
+ : result_(result.Pass()) {
+ DCHECK(result_);
+}
+
+ResolvedHits::~ResolvedHits() {}
+
+void ResolvedHits::AddMapping(uint32_t scene_token_value,
+ mojo::ui::ViewTokenPtr view_token) {
+ DCHECK(scene_token_value);
+ DCHECK(view_token);
+
+ auto pair = map_.emplace(scene_token_value, view_token.Pass());
+ DCHECK(pair.second);
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::ui::ResolvedHits& value) {
+ os << "{result=";
+ if (value.result())
+ os << *value.result();
+ else
+ os << "null";
+ os << ", map={";
+ bool first = true;
+ for (const auto& pair : value.map()) {
+ if (first)
+ first = false;
+ else
+ os << ", ";
+ os << pair.first << ": " << pair.second;
+ }
+ return os << "}}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::ui::ResolvedHits* value) {
+ return value ? os << *value : os << "null";
+}
+
+} // namespace ui
+} // namespace mojo
« no previous file with comments | « mojo/ui/associates/resolved_hits.h ('k') | mojo/ui/associates/test_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698