diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-29 08:12:35 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-29 08:12:35 +0000 |
commit | d77962600d57713bbef18680d333ef400e22668f (patch) | |
tree | 873a7fbebd83151f3a9a196d24a6c82a6416e9d5 /mojo/examples/window_manager | |
parent | afac7312f4245e61a940e0a307f34b8bde8a2ddf (diff) | |
download | chromium_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/window_manager')
-rw-r--r-- | mojo/examples/window_manager/window_manager.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/mojo/examples/window_manager/window_manager.cc b/mojo/examples/window_manager/window_manager.cc index 1f0a4e0..4f09028 100644 --- a/mojo/examples/window_manager/window_manager.cc +++ b/mojo/examples/window_manager/window_manager.cc @@ -10,7 +10,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/services/public/cpp/geometry/geometry_type_converters.h" #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" #include "mojo/services/public/cpp/view_manager/node.h" @@ -251,15 +251,11 @@ class WindowManager : public ApplicationDelegate, public DebugPanel::Delegate, public ViewManagerDelegate, - public WindowManagerDelegate, - public InterfaceFactoryWithContext<WindowManagerConnection, - WindowManager>, - public InterfaceFactoryWithContext<NavigatorHostImpl, WindowManager> { + public WindowManagerDelegate { public: WindowManager() - : InterfaceFactoryWithContext<WindowManagerConnection, WindowManager>( - this), - InterfaceFactoryWithContext<NavigatorHostImpl, WindowManager>(this), + : window_manager_factory_(this), + navigator_host_factory_(this), launcher_ui_(NULL), view_manager_(NULL), view_manager_client_factory_(this), @@ -334,8 +330,8 @@ class WindowManager virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) MOJO_OVERRIDE { - connection->AddService<IWindowManager>(this); - connection->AddService<mojo::NavigatorHost>(this); + connection->AddService(&window_manager_factory_); + connection->AddService(&navigator_host_factory_); connection->AddService(&view_manager_client_factory_); return true; } @@ -503,6 +499,11 @@ class WindowManager return node->id(); } + InterfaceFactoryImplWithContext<WindowManagerConnection, WindowManager> + window_manager_factory_; + InterfaceFactoryImplWithContext<NavigatorHostImpl, WindowManager> + navigator_host_factory_; + scoped_ptr<ViewsInit> views_init_; DebugPanel* debug_panel_; LauncherPtr launcher_; |