Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
Aaron Boodman
2014/10/31 08:24:01
I would expect this class to be in mojo/public/cpp
qsr
2014/10/31 12:10:44
That and because it depended on ApplicationImpl. W
| |
| 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_H_ | |
| 6 #define MOJO_APPLICATION_CONTENT_HANDLER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
|
Aaron Boodman
2014/10/31 08:24:01
move this to cc file.
qsr
2014/10/31 12:10:44
Done.
| |
| 9 #include "mojo/public/c/system/core.h" | |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | |
| 11 #include "mojo/public/interfaces/application/application.mojom.h" | |
| 12 #include "mojo/public/interfaces/application/shell.mojom.h" | |
| 13 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" | |
| 14 | |
| 15 namespace mojo { | |
| 16 | |
| 17 class ContentHandlerDelegate : public ApplicationDelegate { | |
| 18 public: | |
| 19 ContentHandlerDelegate() {} | |
| 20 // Implement this method to create the ApplicationDelegate for the given | |
| 21 // content. The application will be run on its own thread. | |
| 22 virtual scoped_ptr<mojo::InterfaceImpl<mojo::Application>> CreateApplication( | |
| 23 ShellPtr shell, | |
| 24 URLResponsePtr response) = 0; | |
| 25 | |
| 26 private: | |
| 27 DISALLOW_COPY_AND_ASSIGN(ContentHandlerDelegate); | |
| 28 }; | |
| 29 | |
| 30 // A utility for running a chromium based mojo Application that expose a content | |
| 31 // handler. The typical use case is to use when writing your MojoMain: | |
| 32 // | |
| 33 // MojoResult MojoMain(MojoHandle shell_handle) { | |
| 34 // return mojo::ContentHandlerRunner::Run(shell_handle, | |
| 35 // make_scoped_ptr(new MyDelegate)); | |
| 36 // } | |
| 37 class ContentHandlerRunner { | |
| 38 public: | |
| 39 static MojoResult Run(MojoHandle shell_handle, | |
| 40 scoped_ptr<ContentHandlerDelegate> delegate); | |
| 41 | |
| 42 private: | |
| 43 ContentHandlerRunner() {} | |
| 44 }; | |
| 45 | |
| 46 } // namespace mojo | |
| 47 | |
| 48 #endif // MOJO_APPLICATION_CONTENT_HANDLER_H_ | |
| OLD | NEW |