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

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

Issue 853303004: Add Application::RequestQuit() (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: commentary 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 | « no previous file | mojo/public/cpp/application/application_impl.h » ('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 virtual void RequestQuit() override {}
25 26
26 virtual void AcceptConnection(const String& requestor_url, 27 virtual void AcceptConnection(const String& requestor_url,
27 InterfaceRequest<ServiceProvider> services, 28 InterfaceRequest<ServiceProvider> services,
28 ServiceProviderPtr exported_services) override { 29 ServiceProviderPtr exported_services) override {
29 printf("ContentHandler::OnConnect - requestor_url:%s - body follows\n\n", 30 printf("ContentHandler::OnConnect - requestor_url:%s - body follows\n\n",
30 requestor_url.To<std::string>().c_str()); 31 requestor_url.To<std::string>().c_str());
31 PrintResponse(body_.Pass()); 32 PrintResponse(body_.Pass());
32 delete this; 33 delete this;
33 } 34 }
34 35
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 MOJO_DISALLOW_COPY_AND_ASSIGN(ContentHandlerApp); 95 MOJO_DISALLOW_COPY_AND_ASSIGN(ContentHandlerApp);
95 }; 96 };
96 97
97 } // namespace examples 98 } // namespace examples
98 } // namespace mojo 99 } // namespace mojo
99 100
100 MojoResult MojoMain(MojoHandle shell_handle) { 101 MojoResult MojoMain(MojoHandle shell_handle) {
101 mojo::ApplicationRunner runner(new mojo::examples::ContentHandlerApp); 102 mojo::ApplicationRunner runner(new mojo::examples::ContentHandlerApp);
102 return runner.Run(shell_handle); 103 return runner.Run(shell_handle);
103 } 104 }
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/application/application_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698