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

Side by Side Diff: mojo/application/content_handler_factory.h

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 8 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 | « mojo/application/DEPS ('k') | mojo/application/content_handler_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #ifndef MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_
6 #define MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "mojo/public/cpp/application/interface_factory.h"
10 #include "mojo/public/interfaces/application/shell.mojom.h"
11 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
12 #include "third_party/mojo_services/src/content_handler/public/interfaces/conten t_handler.mojom.h"
13
14 namespace mojo {
15
16 class ContentHandlerFactory : public InterfaceFactory<ContentHandler> {
17 public:
18 class HandledApplicationHolder {
19 public:
20 virtual ~HandledApplicationHolder() {}
21 };
22
23 class Delegate {
24 public:
25 virtual ~Delegate() {}
26 // Implement this method to create the Application. This method will be
27 // called on a new thread. Leaving this method will quit the application.
28 virtual void RunApplication(
29 InterfaceRequest<Application> application_request,
30 URLResponsePtr response) = 0;
31 };
32
33 class ManagedDelegate : public Delegate {
34 public:
35 ~ManagedDelegate() override {}
36 // Implement this method to create the Application for the given content.
37 // This method will be called on a new thread. The application will be run
38 // on this new thread, and the returned value will be kept alive until the
39 // application ends.
40 virtual scoped_ptr<HandledApplicationHolder> CreateApplication(
41 InterfaceRequest<Application> application_request,
42 URLResponsePtr response) = 0;
43
44 private:
45 void RunApplication(InterfaceRequest<Application> application_request,
46 URLResponsePtr response) override;
47 };
48
49 explicit ContentHandlerFactory(Delegate* delegate);
50 ~ContentHandlerFactory() override;
51
52 private:
53 // From InterfaceFactory:
54 void Create(ApplicationConnection* connection,
55 InterfaceRequest<ContentHandler> request) override;
56
57 Delegate* delegate_;
58
59 DISALLOW_COPY_AND_ASSIGN(ContentHandlerFactory);
60 };
61
62 template <class A>
63 class HandledApplicationHolderImpl
64 : public ContentHandlerFactory::HandledApplicationHolder {
65 public:
66 explicit HandledApplicationHolderImpl(A* value) : value_(value) {}
67
68 private:
69 scoped_ptr<A> value_;
70 };
71
72 template <class A>
73 scoped_ptr<ContentHandlerFactory::HandledApplicationHolder>
74 make_handled_factory_holder(A* value) {
75 return make_scoped_ptr(new HandledApplicationHolderImpl<A>(value));
76 }
77
78 } // namespace mojo
79
80 #endif // MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_
OLDNEW
« no previous file with comments | « mojo/application/DEPS ('k') | mojo/application/content_handler_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698