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

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

Issue 1979723002: ApplicationConnection devolution, part 3. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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/echo_terminal/main.cc ('k') | examples/hello_mojo/hello_mojo_server.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 <utility> 5 #include <utility>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "mojo/application/application_runner_chromium.h" 9 #include "mojo/application/application_runner_chromium.h"
10 #include "mojo/application/content_handler_factory.h" 10 #include "mojo/application/content_handler_factory.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ShellPtr shell_; 51 ShellPtr shell_;
52 }; 52 };
53 53
54 class ForwardingContentHandler : public ApplicationDelegate, 54 class ForwardingContentHandler : public ApplicationDelegate,
55 public ContentHandlerFactory::ManagedDelegate { 55 public ContentHandlerFactory::ManagedDelegate {
56 public: 56 public:
57 ForwardingContentHandler() : content_handler_factory_(this) {} 57 ForwardingContentHandler() : content_handler_factory_(this) {}
58 58
59 private: 59 private:
60 // Overridden from ApplicationDelegate: 60 // Overridden from ApplicationDelegate:
61 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { 61 bool ConfigureIncomingConnection(
62 connection->GetServiceProviderImpl().AddService<ContentHandler>( 62 ServiceProviderImpl* service_provider_impl) override {
63 service_provider_impl->AddService<ContentHandler>(
63 content_handler_factory_.GetInterfaceRequestHandler()); 64 content_handler_factory_.GetInterfaceRequestHandler());
64 return true; 65 return true;
65 } 66 }
66 67
67 // Overridden from ContentHandlerFactory::ManagedDelegate: 68 // Overridden from ContentHandlerFactory::ManagedDelegate:
68 scoped_ptr<ContentHandlerFactory::HandledApplicationHolder> 69 scoped_ptr<ContentHandlerFactory::HandledApplicationHolder>
69 CreateApplication(InterfaceRequest<Application> application_request, 70 CreateApplication(InterfaceRequest<Application> application_request,
70 URLResponsePtr response) override { 71 URLResponsePtr response) override {
71 CHECK(!response.is_null()); 72 CHECK(!response.is_null());
72 const std::string requestor_url(response->url); 73 const std::string requestor_url(response->url);
(...skipping 12 matching lines...) Expand all
85 }; 86 };
86 87
87 } // namespace examples 88 } // namespace examples
88 } // namespace mojo 89 } // namespace mojo
89 90
90 MojoResult MojoMain(MojoHandle application_request) { 91 MojoResult MojoMain(MojoHandle application_request) {
91 mojo::ApplicationRunnerChromium runner( 92 mojo::ApplicationRunnerChromium runner(
92 new mojo::examples::ForwardingContentHandler()); 93 new mojo::examples::ForwardingContentHandler());
93 return runner.Run(application_request); 94 return runner.Run(application_request);
94 } 95 }
OLDNEW
« no previous file with comments | « examples/echo_terminal/main.cc ('k') | examples/hello_mojo/hello_mojo_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698