Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: examples/content_handler_demo/content_handler_demo.cc

Issue 845593003: Pass ServiceProvider and ServiceProvider& params in Connect (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: use nullptr instead of ServiceProviderPtr(), fix ShellImpl Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « examples/bitmap_uploader/bitmap_uploader.cc ('k') | examples/ganesh_app/texture_uploader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "mojo/public/c/system/main.h" 7 #include "mojo/public/c/system/main.h"
8 #include "mojo/public/cpp/application/application_delegate.h" 8 #include "mojo/public/cpp/application/application_delegate.h"
9 #include "mojo/public/cpp/application/application_impl.h" 9 #include "mojo/public/cpp/application/application_impl.h"
10 #include "mojo/public/cpp/application/application_runner.h" 10 #include "mojo/public/cpp/application/application_runner.h"
11 #include "mojo/public/cpp/application/interface_factory_impl.h" 11 #include "mojo/public/cpp/application/interface_factory_impl.h"
12 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom. h" 12 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom. h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace examples { 15 namespace examples {
16 16
17 class PrintBodyApplication : public InterfaceImpl<Application> { 17 class PrintBodyApplication : public InterfaceImpl<Application> {
18 public: 18 public:
19 PrintBodyApplication(ShellPtr shell, ScopedDataPipeConsumerHandle body) 19 PrintBodyApplication(ShellPtr shell, ScopedDataPipeConsumerHandle body)
20 : shell_(shell.Pass()), body_(body.Pass()) { 20 : shell_(shell.Pass()), body_(body.Pass()) {
21 shell_.set_client(this); 21 shell_.set_client(this);
22 } 22 }
23 23
24 virtual void Initialize(Array<String> args) override {} 24 virtual void Initialize(Array<String> args) override {}
25 25
26 virtual void AcceptConnection(const String& requestor_url, 26 virtual void AcceptConnection(const String& requestor_url,
27 ServiceProviderPtr service_provider) override { 27 InterfaceRequest<ServiceProvider> services,
28 ServiceProviderPtr exported_services) override {
28 printf("ContentHandler::OnConnect - requestor_url:%s - body follows\n\n", 29 printf("ContentHandler::OnConnect - requestor_url:%s - body follows\n\n",
29 requestor_url.To<std::string>().c_str()); 30 requestor_url.To<std::string>().c_str());
30 PrintResponse(body_.Pass()); 31 PrintResponse(body_.Pass());
31 delete this; 32 delete this;
32 } 33 }
33 34
34 private: 35 private:
35 void PrintResponse(ScopedDataPipeConsumerHandle body) const { 36 void PrintResponse(ScopedDataPipeConsumerHandle body) const {
36 for (;;) { 37 for (;;) {
37 char buf[512]; 38 char buf[512];
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 MOJO_DISALLOW_COPY_AND_ASSIGN(ContentHandlerApp); 94 MOJO_DISALLOW_COPY_AND_ASSIGN(ContentHandlerApp);
94 }; 95 };
95 96
96 } // namespace examples 97 } // namespace examples
97 } // namespace mojo 98 } // namespace mojo
98 99
99 MojoResult MojoMain(MojoHandle shell_handle) { 100 MojoResult MojoMain(MojoHandle shell_handle) {
100 mojo::ApplicationRunner runner(new mojo::examples::ContentHandlerApp); 101 mojo::ApplicationRunner runner(new mojo::examples::ContentHandlerApp);
101 return runner.Run(shell_handle); 102 return runner.Run(shell_handle);
102 } 103 }
OLDNEW
« no previous file with comments | « examples/bitmap_uploader/bitmap_uploader.cc ('k') | examples/ganesh_app/texture_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698