summaryrefslogtreecommitdiffstats
path: root/mojo/examples/media_viewer
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-29 08:12:35 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-29 08:12:35 +0000
commitd77962600d57713bbef18680d333ef400e22668f (patch)
tree873a7fbebd83151f3a9a196d24a6c82a6416e9d5 /mojo/examples/media_viewer
parentafac7312f4245e61a940e0a307f34b8bde8a2ddf (diff)
downloadchromium_src-d77962600d57713bbef18680d333ef400e22668f.zip
chromium_src-d77962600d57713bbef18680d333ef400e22668f.tar.gz
chromium_src-d77962600d57713bbef18680d333ef400e22668f.tar.bz2
Mojo: add InterfaceFactoryImpl, use composition rather than inheritance.
InterfaceFactoryWithContext is renamed InterfaceFactoryImplWithContext, and InterfaceFactoryImpl is introduced for cases where a Context is not needed but the stock ownership and allocation scheme is sufficient. Add simple echo service and client to demonstrate the simplest service- providing app and service-consuming app. Review URL: https://codereview.chromium.org/426543002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/media_viewer')
-rw-r--r--mojo/examples/media_viewer/media_viewer.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/mojo/examples/media_viewer/media_viewer.cc b/mojo/examples/media_viewer/media_viewer.cc
index 908c444..c886710 100644
--- a/mojo/examples/media_viewer/media_viewer.cc
+++ b/mojo/examples/media_viewer/media_viewer.cc
@@ -12,7 +12,7 @@
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
-#include "mojo/public/cpp/application/interface_factory_with_context.h"
+#include "mojo/public/cpp/application/interface_factory_impl.h"
#include "mojo/public/cpp/bindings/interface_impl.h"
#include "mojo/services/public/cpp/view_manager/node.h"
#include "mojo/services/public/cpp/view_manager/node_observer.h"
@@ -206,14 +206,13 @@ class MediaViewer
: public ApplicationDelegate,
public ViewManagerDelegate,
public ControlPanel::Delegate,
- public NodeObserver,
- public InterfaceFactoryWithContext<NavigatorImpl, MediaViewer> {
+ public NodeObserver {
public:
MediaViewer()
- : InterfaceFactoryWithContext(this),
+ : navigator_factory_(this),
+ view_manager_client_factory_(this),
app_(NULL),
view_manager_(NULL),
- view_manager_client_factory_(this),
root_node_(NULL),
control_node_(NULL),
content_node_(NULL),
@@ -277,7 +276,7 @@ class MediaViewer
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
OVERRIDE {
- connection->AddService(this);
+ connection->AddService(&navigator_factory_);
connection->AddService(&view_manager_client_factory_);
return true;
}
@@ -357,10 +356,13 @@ class MediaViewer
return it != handler_map_.end() ? it->second : std::string();
}
+ InterfaceFactoryImplWithContext<NavigatorImpl, MediaViewer>
+ navigator_factory_;
+ ViewManagerClientFactory view_manager_client_factory_;
+
ApplicationImpl* app_;
scoped_ptr<ViewsInit> views_init_;
ViewManager* view_manager_;
- ViewManagerClientFactory view_manager_client_factory_;
Node* root_node_;
Node* control_node_;
Node* content_node_;