OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_LOG_LOG_IMPL_H_ |
| 6 #define SERVICES_LOG_LOG_IMPL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "mojo/public/cpp/bindings/interface_request.h" |
| 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 12 #include "mojo/services/log/interfaces/entry.mojom.h" |
| 13 #include "mojo/services/log/interfaces/log.mojom.h" |
| 14 |
| 15 namespace mojo { |
| 16 |
| 17 class ApplicationConnection; |
| 18 |
| 19 namespace log { |
| 20 |
| 21 // This is an implementation of the log service |
| 22 // (see mojo/services/log/interfaces/log.mojom). It only formats incoming |
| 23 // messages and prints them to stderr. |
| 24 // |
| 25 // This service implementation binds a new Log implementation for each incoming |
| 26 // application connection. |
| 27 class LogImpl : public Log { |
| 28 public: |
| 29 static void Create(ApplicationConnection* connection, |
| 30 InterfaceRequest<Log> request); |
| 31 |
| 32 // |Log| implementation: |
| 33 void AddEntry(EntryPtr entry) override; |
| 34 |
| 35 private: |
| 36 LogImpl(const std::string& remote_url, InterfaceRequest<Log> request); |
| 37 ~LogImpl() override; |
| 38 |
| 39 std::string FormatEntry(const EntryPtr& entry); |
| 40 |
| 41 const std::string remote_url_; |
| 42 StrongBinding<Log> binding_; |
| 43 |
| 44 MOJO_DISALLOW_COPY_AND_ASSIGN(LogImpl); |
| 45 }; |
| 46 |
| 47 } // namespace log |
| 48 } // namespace mojo |
| 49 |
| 50 #endif // SERVICES_LOG_LOG_IMPL_H_ |
OLD | NEW |