| Index: mojo/examples/png_viewer/png_viewer.cc
|
| diff --git a/mojo/examples/png_viewer/png_viewer.cc b/mojo/examples/png_viewer/png_viewer.cc
|
| index a6f87417bad4f50a075919dd017923d6c46363a3..9262b908aed7abf94646dc40edb2a78fb4bfa388 100644
|
| --- a/mojo/examples/png_viewer/png_viewer.cc
|
| +++ b/mojo/examples/png_viewer/png_viewer.cc
|
| @@ -9,6 +9,7 @@
|
| #include "mojo/examples/media_viewer/media_viewer.mojom.h"
|
| #include "mojo/public/cpp/application/application_connection.h"
|
| #include "mojo/public/cpp/application/application_delegate.h"
|
| +#include "mojo/public/cpp/application/context_interface_provider.h"
|
| #include "mojo/services/public/cpp/view_manager/node.h"
|
| #include "mojo/services/public/cpp/view_manager/types.h"
|
| #include "mojo/services/public/cpp/view_manager/view.h"
|
| @@ -30,8 +31,7 @@ class PNGViewer;
|
|
|
| class ZoomableMediaImpl : public InterfaceImpl<ZoomableMedia> {
|
| public:
|
| - ZoomableMediaImpl(ApplicationConnection* connection,
|
| - PNGViewer* viewer) : viewer_(viewer) {}
|
| + explicit ZoomableMediaImpl(PNGViewer* viewer) : viewer_(viewer) {}
|
| virtual ~ZoomableMediaImpl() {}
|
|
|
| private:
|
| @@ -47,8 +47,7 @@ class ZoomableMediaImpl : public InterfaceImpl<ZoomableMedia> {
|
|
|
| class NavigatorImpl : public InterfaceImpl<navigation::Navigator> {
|
| public:
|
| - NavigatorImpl(ApplicationConnection* connection,
|
| - PNGViewer* viewer) : viewer_(viewer) {}
|
| + explicit NavigatorImpl(PNGViewer* viewer) : viewer_(viewer) {}
|
| virtual ~NavigatorImpl() {}
|
|
|
| private:
|
| @@ -110,10 +109,17 @@ class NavigatorImpl : public InterfaceImpl<navigation::Navigator> {
|
| DISALLOW_COPY_AND_ASSIGN(NavigatorImpl);
|
| };
|
|
|
| -class PNGViewer : public ApplicationDelegate,
|
| - public view_manager::ViewManagerDelegate {
|
| +class PNGViewer
|
| + : public ApplicationDelegate,
|
| + public view_manager::ViewManagerDelegate,
|
| + public ContextInterfaceProvider<NavigatorImpl, PNGViewer>,
|
| + public ContextInterfaceProvider<ZoomableMediaImpl, PNGViewer> {
|
| public:
|
| - PNGViewer() : content_view_(NULL), zoom_percentage_(kDefaultZoomPercentage) {}
|
| + PNGViewer()
|
| + : ContextInterfaceProvider<NavigatorImpl, PNGViewer>(this),
|
| + ContextInterfaceProvider<ZoomableMediaImpl, PNGViewer>(this),
|
| + content_view_(NULL),
|
| + zoom_percentage_(kDefaultZoomPercentage) {}
|
| virtual ~PNGViewer() {}
|
|
|
| void UpdateView(view_manager::Id node_id, const SkBitmap& bitmap) {
|
| @@ -152,8 +158,8 @@ class PNGViewer : public ApplicationDelegate,
|
| // Overridden from ApplicationDelegate:
|
| virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
|
| MOJO_OVERRIDE {
|
| - connection->AddService<NavigatorImpl>(this);
|
| - connection->AddService<ZoomableMediaImpl>(this);
|
| + connection->AddServiceProvider<navigation::Navigator>(this);
|
| + connection->AddServiceProvider<ZoomableMedia>(this);
|
| view_manager::ViewManager::ConfigureIncomingConnection(connection, this);
|
| return true;
|
| }
|
|
|