Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / mojo / services / view_manager / main.cc
index de0a768..9f6285f 100644 (file)
@@ -2,34 +2,47 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/application/application.h"
+#include "mojo/public/cpp/application/application_connection.h"
+#include "mojo/public/cpp/application/application_delegate.h"
+#include "mojo/services/view_manager/view_manager_init_service_context.h"
 #include "mojo/services/view_manager/view_manager_init_service_impl.h"
 
 namespace mojo {
-namespace view_manager {
 namespace service {
 
-class ViewManagerApp : public Application {
+class ViewManagerApp : public ApplicationDelegate,
+                       public InterfaceFactory<ViewManagerInitService> {
  public:
   ViewManagerApp() {}
   virtual ~ViewManagerApp() {}
 
-  virtual void Initialize() MOJO_OVERRIDE {
+  virtual bool ConfigureIncomingConnection(
+      ApplicationConnection* connection) OVERRIDE {
+    context_.ConfigureIncomingConnection(connection);
     // TODO(sky): this needs some sort of authentication as well as making sure
     // we only ever have one active at a time.
-    AddService<ViewManagerInitServiceImpl>(service_provider());
+    connection->AddService(this);
+    return true;
+  }
+
+  virtual void Create(
+      ApplicationConnection* connection,
+      InterfaceRequest<ViewManagerInitService> request) OVERRIDE {
+    BindToRequest(new ViewManagerInitServiceImpl(connection, &context_),
+                  &request);
   }
 
  private:
+  ViewManagerInitServiceContext context_;
+
   DISALLOW_COPY_AND_ASSIGN(ViewManagerApp);
 };
 
 }  // namespace service
-}  // namespace view_manager
 
 // static
-Application* Application::Create() {
-  return new mojo::view_manager::service::ViewManagerApp();
+ApplicationDelegate* ApplicationDelegate::Create() {
+  return new mojo::service::ViewManagerApp();
 }
 
 }  // namespace mojo