OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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/examples/surfaces_app/child_impl.h" |
| 6 #include "mojo/public/cpp/application/application_connection.h" |
| 7 #include "mojo/public/cpp/application/application_delegate.h" |
| 8 #include "mojo/public/cpp/application/application_impl.h" |
| 9 #include "mojo/public/cpp/bindings/string.h" |
| 10 |
| 11 namespace mojo { |
| 12 namespace examples { |
| 13 |
| 14 class ChildApp : public ApplicationDelegate, public ChildImpl::Context { |
| 15 public: |
| 16 ChildApp() {} |
| 17 virtual ~ChildApp() {} |
| 18 |
| 19 virtual void Initialize(ApplicationImpl* app) OVERRIDE { app_ = app; } |
| 20 |
| 21 // ApplicationDelegate implementation. |
| 22 virtual bool ConfigureIncomingConnection( |
| 23 ApplicationConnection* connection) OVERRIDE { |
| 24 connection->AddService<ChildImpl>(this); |
| 25 return true; |
| 26 } |
| 27 |
| 28 // ChildImpl::Context implementation. |
| 29 virtual ApplicationConnection* ShellConnection( |
| 30 const mojo::String& application_url) OVERRIDE { |
| 31 return app_->ConnectToApplication(application_url); |
| 32 } |
| 33 |
| 34 private: |
| 35 ApplicationImpl* app_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(ChildApp); |
| 38 }; |
| 39 |
| 40 } // namespace examples |
| 41 |
| 42 // static |
| 43 ApplicationDelegate* ApplicationDelegate::Create() { |
| 44 return new examples::ChildApp(); |
| 45 } |
| 46 |
| 47 } // namespace mojo |
OLD | NEW |