OLD | NEW |
(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 |
OLD | NEW |