| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "examples/echo_terminal/terminal_client.mojom.h" | |
| 10 #include "mojo/application/application_runner_chromium.h" | 9 #include "mojo/application/application_runner_chromium.h" |
| 11 #include "mojo/common/weak_binding_set.h" | 10 #include "mojo/common/weak_binding_set.h" |
| 12 #include "mojo/public/c/system/main.h" | 11 #include "mojo/public/c/system/main.h" |
| 13 #include "mojo/public/cpp/application/application_connection.h" | 12 #include "mojo/public/cpp/application/application_connection.h" |
| 14 #include "mojo/public/cpp/application/application_delegate.h" | 13 #include "mojo/public/cpp/application/application_delegate.h" |
| 15 #include "mojo/public/cpp/application/interface_factory.h" | 14 #include "mojo/public/cpp/application/interface_factory.h" |
| 16 #include "services/files/file.mojom.h" | 15 #include "mojo/services/files/public/interfaces/file.mojom.h" |
| 17 #include "services/files/types.mojom.h" | 16 #include "mojo/services/files/public/interfaces/types.mojom.h" |
| 17 #include "mojo/services/terminal/public/interfaces/terminal_client.mojom.h" |
| 18 | 18 |
| 19 const uint32_t kMaxBytesToRead = 1000; | 19 const uint32_t kMaxBytesToRead = 1000; |
| 20 | 20 |
| 21 // Owns itself. | 21 // Owns itself. |
| 22 class TerminalEchoer : mojo::ErrorHandler { | 22 class TerminalEchoer : mojo::ErrorHandler { |
| 23 public: | 23 public: |
| 24 explicit TerminalEchoer(mojo::files::FilePtr terminal) | 24 explicit TerminalEchoer(mojo::files::FilePtr terminal) |
| 25 : terminal_(terminal.Pass()), last_bytes_read_size_(0) {} | 25 : terminal_(terminal.Pass()), last_bytes_read_size_(0) {} |
| 26 | 26 |
| 27 void StartReading() { | 27 void StartReading() { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 mojo::WeakBindingSet<mojo::terminal::TerminalClient> terminal_clients_; | 125 mojo::WeakBindingSet<mojo::terminal::TerminalClient> terminal_clients_; |
| 126 | 126 |
| 127 DISALLOW_COPY_AND_ASSIGN(EchoTerminalApp); | 127 DISALLOW_COPY_AND_ASSIGN(EchoTerminalApp); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 MojoResult MojoMain(MojoHandle shell_handle) { | 130 MojoResult MojoMain(MojoHandle shell_handle) { |
| 131 mojo::ApplicationRunnerChromium runner(new EchoTerminalApp()); | 131 mojo::ApplicationRunnerChromium runner(new EchoTerminalApp()); |
| 132 return runner.Run(shell_handle); | 132 return runner.Run(shell_handle); |
| 133 } | 133 } |
| OLD | NEW |