summaryrefslogtreecommitdiffstats
path: root/mojo/examples/nesting_app
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/nesting_app
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/nesting_app')
-rw-r--r--mojo/examples/nesting_app/nesting_app.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/mojo/examples/nesting_app/nesting_app.cc b/mojo/examples/nesting_app/nesting_app.cc
index 0d22d62..9c91372 100644
--- a/mojo/examples/nesting_app/nesting_app.cc
+++ b/mojo/examples/nesting_app/nesting_app.cc
@@ -9,7 +9,7 @@
#include "mojo/examples/window_manager/window_manager.mojom.h"
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.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/view_manager/node.h"
#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/view.h"
@@ -50,13 +50,12 @@ class NestingApp
: public ApplicationDelegate,
public ViewManagerDelegate,
public ViewObserver,
- public NodeObserver,
- public InterfaceFactoryWithContext<NavigatorImpl, NestingApp> {
+ public NodeObserver {
public:
NestingApp()
- : InterfaceFactoryWithContext(this),
- nested_(NULL),
- view_manager_client_factory_(this) {}
+ : navigator_factory_(this),
+ view_manager_client_factory_(this),
+ nested_(NULL) {}
virtual ~NestingApp() {}
void set_color(const std::string& color) { color_ = color; }
@@ -78,7 +77,7 @@ class NestingApp
MOJO_OVERRIDE {
connection->ConnectToService(&window_manager_);
connection->AddService(&view_manager_client_factory_);
- connection->AddService(this);
+ connection->AddService(&navigator_factory_);
// TODO(davemoore): Is this ok?
if (!navigator_) {
connection->ConnectToApplication(
@@ -119,11 +118,13 @@ class NestingApp
nested_ = NULL;
}
+ InterfaceFactoryImplWithContext<NavigatorImpl, NestingApp> navigator_factory_;
+ ViewManagerClientFactory view_manager_client_factory_;
+
std::string color_;
Node* nested_;
NavigatorPtr navigator_;
IWindowManagerPtr window_manager_;
- ViewManagerClientFactory view_manager_client_factory_;
DISALLOW_COPY_AND_ASSIGN(NestingApp);
};