OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
10 #include "mojo/public/cpp/application/application_impl_base.h" | 10 #include "mojo/public/cpp/application/application_impl_base.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 : binding_(this, request.Pass()), body_(body.Pass()) {} | 24 : binding_(this, request.Pass()), body_(body.Pass()) {} |
25 | 25 |
26 void Initialize(InterfaceHandle<Shell> shell, | 26 void Initialize(InterfaceHandle<Shell> shell, |
27 Array<String> args, | 27 Array<String> args, |
28 const mojo::String& url) override { | 28 const mojo::String& url) override { |
29 shell_ = ShellPtr::Create(std::move(shell)); | 29 shell_ = ShellPtr::Create(std::move(shell)); |
30 } | 30 } |
31 void RequestQuit() override {} | 31 void RequestQuit() override {} |
32 | 32 |
33 void AcceptConnection(const String& requestor_url, | 33 void AcceptConnection(const String& requestor_url, |
34 InterfaceRequest<ServiceProvider> services, | 34 const String& url, |
35 InterfaceHandle<ServiceProvider> exported_services, | 35 InterfaceRequest<ServiceProvider> services) override { |
36 const String& url) override { | |
37 printf( | 36 printf( |
38 "ContentHandler::OnConnect - url:%s - requestor_url:%s - body " | 37 "ContentHandler::OnConnect - url:%s - requestor_url:%s - body " |
39 "follows\n\n", | 38 "follows\n\n", |
40 url.To<std::string>().c_str(), requestor_url.To<std::string>().c_str()); | 39 url.To<std::string>().c_str(), requestor_url.To<std::string>().c_str()); |
41 PrintResponse(body_.Pass()); | 40 PrintResponse(body_.Pass()); |
42 delete this; | 41 delete this; |
43 } | 42 } |
44 | 43 |
45 private: | 44 private: |
46 void PrintResponse(ScopedDataPipeConsumerHandle body) const { | 45 void PrintResponse(ScopedDataPipeConsumerHandle body) const { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 MOJO_DISALLOW_COPY_AND_ASSIGN(ContentHandlerApp); | 108 MOJO_DISALLOW_COPY_AND_ASSIGN(ContentHandlerApp); |
110 }; | 109 }; |
111 | 110 |
112 } // namespace examples | 111 } // namespace examples |
113 } // namespace mojo | 112 } // namespace mojo |
114 | 113 |
115 MojoResult MojoMain(MojoHandle application_request) { | 114 MojoResult MojoMain(MojoHandle application_request) { |
116 mojo::examples::ContentHandlerApp content_handler_app; | 115 mojo::examples::ContentHandlerApp content_handler_app; |
117 return mojo::RunApplication(application_request, &content_handler_app); | 116 return mojo::RunApplication(application_request, &content_handler_app); |
118 } | 117 } |
OLD | NEW |