Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / mojo / shell / view_manager_loader.cc
index 278ab81..844e8a7 100644 (file)
@@ -4,10 +4,14 @@
 
 #include "mojo/shell/view_manager_loader.h"
 
-#include "mojo/public/cpp/application/application.h"
+#include "mojo/public/cpp/application/application_connection.h"
+#include "mojo/public/cpp/application/application_impl.h"
 #include "mojo/services/view_manager/view_manager_init_service_impl.h"
 
 namespace mojo {
+
+using service::ViewManagerInitServiceImpl;
+
 namespace shell {
 
 ViewManagerLoader::ViewManagerLoader() {
@@ -16,21 +20,37 @@ ViewManagerLoader::ViewManagerLoader() {
 ViewManagerLoader::~ViewManagerLoader() {
 }
 
-void ViewManagerLoader::LoadService(
-    ServiceManager* manager,
-    const GURL& url,
-    ScopedMessagePipeHandle service_provider_handle) {
+void ViewManagerLoader::Load(ApplicationManager* manager,
+                             const GURL& url,
+                             scoped_refptr<LoadCallbacks> callbacks) {
+  ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication();
+  if (!shell_handle.is_valid())
+    return;
+
   // TODO(sky): this needs some sort of authentication as well as making sure
   // we only ever have one active at a time.
-  scoped_ptr<Application> app(new Application(service_provider_handle.Pass()));
-  app->AddService<view_manager::service::ViewManagerInitServiceImpl>(
-      app->service_provider());
+  scoped_ptr<ApplicationImpl> app(
+      new ApplicationImpl(this, shell_handle.Pass()));
   apps_.push_back(app.release());
 }
 
-void ViewManagerLoader::OnServiceError(ServiceManager* manager,
+void ViewManagerLoader::OnServiceError(ApplicationManager* manager,
                                        const GURL& url) {
 }
 
+bool ViewManagerLoader::ConfigureIncomingConnection(
+    ApplicationConnection* connection)  {
+  context_.ConfigureIncomingConnection(connection);
+  connection->AddService(this);
+  return true;
+}
+
+void ViewManagerLoader::Create(
+    ApplicationConnection* connection,
+    InterfaceRequest<ViewManagerInitService> request) {
+  BindToRequest(new ViewManagerInitServiceImpl(connection, &context_),
+                &request);
+}
+
 }  // namespace shell
 }  // namespace mojo