| OLD | NEW |
| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "mojo/public/c/system/main.h" | 7 #include "mojo/public/c/system/main.h" |
| 8 #include "mojo/public/cpp/application/application_connection.h" | 8 #include "mojo/public/cpp/application/application_connection.h" |
| 9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
| 10 #include "mojo/public/cpp/application/application_runner.h" | 10 #include "mojo/public/cpp/application/application_runner.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (employees_.find(id) == employees_.end()) | 60 if (employees_.find(id) == employees_.end()) |
| 61 employees_[id] = new EmployeeInfo(); | 61 employees_[id] = new EmployeeInfo(); |
| 62 employees_[id]->employee = employee.Pass(); | 62 employees_[id]->employee = employee.Pass(); |
| 63 callback.Run(true); | 63 callback.Run(true); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void QueryEmployee(uint64_t id, | 66 void QueryEmployee(uint64_t id, |
| 67 bool retrieve_finger_print, | 67 bool retrieve_finger_print, |
| 68 const QueryEmployeeCallback& callback) override { | 68 const QueryEmployeeCallback& callback) override { |
| 69 if (employees_.find(id) == employees_.end()) { | 69 if (employees_.find(id) == employees_.end()) { |
| 70 callback.Run(nullptr, Array<uint8_t>()); | 70 callback.Run(nullptr, nullptr); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 callback.Run(employees_[id]->employee.Clone(), | 73 callback.Run( |
| 74 retrieve_finger_print ? employees_[id]->finger_print.Clone() | 74 employees_[id]->employee.Clone(), |
| 75 : Array<uint8_t>()); | 75 retrieve_finger_print ? employees_[id]->finger_print.Clone() : nullptr); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void AttachFingerPrint(uint64_t id, | 78 void AttachFingerPrint(uint64_t id, |
| 79 Array<uint8_t> finger_print, | 79 Array<uint8_t> finger_print, |
| 80 const AttachFingerPrintCallback& callback) override { | 80 const AttachFingerPrintCallback& callback) override { |
| 81 if (employees_.find(id) == employees_.end()) { | 81 if (employees_.find(id) == employees_.end()) { |
| 82 callback.Run(false); | 82 callback.Run(false); |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 employees_[id]->finger_print = finger_print.Pass(); | 85 employees_[id]->finger_print = finger_print.Pass(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 116 } // namespace versioning | 116 } // namespace versioning |
| 117 } // namespace test | 117 } // namespace test |
| 118 } // namespace mojo | 118 } // namespace mojo |
| 119 | 119 |
| 120 MojoResult MojoMain(MojoHandle application_request) { | 120 MojoResult MojoMain(MojoHandle application_request) { |
| 121 mojo::ApplicationRunner runner( | 121 mojo::ApplicationRunner runner( |
| 122 new mojo::test::versioning::HumanResourceSystemServer()); | 122 new mojo::test::versioning::HumanResourceSystemServer()); |
| 123 | 123 |
| 124 return runner.Run(application_request); | 124 return runner.Run(application_request); |
| 125 } | 125 } |
| OLD | NEW |