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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/ui/associates/resolved_hits.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "mojo/services/gfx/composition/cpp/formatting.h"
10 #include "mojo/services/ui/views/cpp/formatting.h"
11
12 namespace mojo {
13 namespace ui {
14
15 ResolvedHits::ResolvedHits(mojo::gfx::composition::HitTestResultPtr result)
16 : result_(result.Pass()) {
17 DCHECK(result_);
18 }
19
20 ResolvedHits::~ResolvedHits() {}
21
22 void ResolvedHits::AddMapping(uint32_t scene_token_value,
23 mojo::ui::ViewTokenPtr view_token) {
24 DCHECK(scene_token_value);
25 DCHECK(view_token);
26
27 auto pair = map_.emplace(scene_token_value, view_token.Pass());
28 DCHECK(pair.second);
29 }
30
31 std::ostream& operator<<(std::ostream& os,
32 const mojo::ui::ResolvedHits& value) {
33 os << "{result=";
34 if (value.result())
35 os << *value.result();
36 else
37 os << "null";
38 os << ", map={";
39 bool first = true;
40 for (const auto& pair : value.map()) {
41 if (first)
42 first = false;
43 else
44 os << ", ";
45 os << pair.first << ": " << pair.second;
46 }
47 return os << "}}";
48 }
49
50 std::ostream& operator<<(std::ostream& os,
51 const mojo::ui::ResolvedHits* value) {
52 return value ? os << *value : os << "null";
53 }
54
55 } // namespace ui
56 } // namespace mojo
OLDNEW
« 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