Index: examples/pdf_viewer/pdf_viewer.cc |
diff --git a/examples/pdf_viewer/pdf_viewer.cc b/examples/pdf_viewer/pdf_viewer.cc |
index ed60a55bf09d646a8bcfd3bb9c30829d05957070..ed81932fd92d5f56c14cd36919b4a519b44a357e 100644 |
--- a/examples/pdf_viewer/pdf_viewer.cc |
+++ b/examples/pdf_viewer/pdf_viewer.cc |
@@ -192,9 +192,9 @@ class PDFView : public ApplicationDelegate, |
DISALLOW_COPY_AND_ASSIGN(PDFView); |
}; |
-class PDFViewer : public ContentHandlerDelegate { |
+class PDFViewer : public ApplicationDelegate, ContentHandlerFactory::Delegate { |
public: |
- PDFViewer() { |
+ PDFViewer() : content_handler_factory_(this) { |
v8::V8::InitializeICU(); |
FPDF_InitLibrary(NULL); |
} |
@@ -203,14 +203,21 @@ class PDFViewer : public ContentHandlerDelegate { |
FPDF_DestroyLibrary(); |
} |
private: |
- // Overridden from ContentHandlerDelegate: |
- virtual scoped_ptr<mojo::InterfaceImpl<mojo::Application>> CreateApplication( |
- ShellPtr shell, |
+ // Overridden from ApplicationDelegate: |
+ virtual bool ConfigureIncomingConnection( |
+ ApplicationConnection* connection) override { |
+ connection->AddService(&content_handler_factory_); |
+ return true; |
+ } |
+ |
+ // Overridden from ContentHandlerFactory::Delegate: |
+ virtual ApplicationDelegate* CreateApplication( |
URLResponsePtr response) override { |
- return make_scoped_ptr(new mojo::ApplicationImpl( |
- new PDFView(response.Pass()), shell.PassMessagePipe())); |
+ return new PDFView(response.Pass()); |
} |
+ ContentHandlerFactory content_handler_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PDFViewer); |
}; |
@@ -218,6 +225,6 @@ class PDFViewer : public ContentHandlerDelegate { |
} // namespace mojo |
MojoResult MojoMain(MojoHandle shell_handle) { |
- return mojo::ContentHandlerRunner::Run( |
- shell_handle, make_scoped_ptr(new mojo::examples::PDFViewer)); |
+ mojo::ApplicationRunnerChromium runner(new mojo::examples::PDFViewer()); |
+ return runner.Run(shell_handle); |
} |