Changes ViewManagerServiceImpl so that it no longer subclasses InterfaceImpl

This is part 1 of refactoring view manager server.

R=msw@chromium.org

Review URL: https://codereview.chromium.org/721243003
diff --git a/mojo/services/view_manager/BUILD.gn b/mojo/services/view_manager/BUILD.gn
index 0dc49d7..bf7878c 100644
--- a/mojo/services/view_manager/BUILD.gn
+++ b/mojo/services/view_manager/BUILD.gn
@@ -21,6 +21,8 @@
   sources = [
     "access_policy.h",
     "access_policy_delegate.h",
+    "client_connection.cc",
+    "client_connection.h",
     "connection_manager.cc",
     "connection_manager.h",
     "connection_manager_delegate.h",
diff --git a/mojo/services/view_manager/client_connection.cc b/mojo/services/view_manager/client_connection.cc
new file mode 100644
index 0000000..0b77b97
--- /dev/null
+++ b/mojo/services/view_manager/client_connection.cc
@@ -0,0 +1,37 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/services/view_manager/client_connection.h"
+
+#include "mojo/services/view_manager/connection_manager.h"
+#include "mojo/services/view_manager/view_manager_service_impl.h"
+
+namespace mojo {
+namespace service {
+
+ClientConnection::ClientConnection(scoped_ptr<ViewManagerServiceImpl> service)
+    : service_(service.Pass()), client_(nullptr) {
+}
+
+ClientConnection::~ClientConnection() {
+}
+
+DefaultClientConnection::DefaultClientConnection(
+    scoped_ptr<ViewManagerServiceImpl> service_impl,
+    ConnectionManager* connection_manager)
+    : ClientConnection(service_impl.Pass()),
+      connection_manager_(connection_manager),
+      binding_(service()) {
+  binding_.set_error_handler(this);
+}
+
+DefaultClientConnection::~DefaultClientConnection() {
+}
+
+void DefaultClientConnection::OnConnectionError() {
+  connection_manager_->OnConnectionError(this);
+}
+
+}  // namespace service
+}  // namespace mojo
diff --git a/mojo/services/view_manager/client_connection.h b/mojo/services/view_manager/client_connection.h
new file mode 100644
index 0000000..6bce910
--- /dev/null
+++ b/mojo/services/view_manager/client_connection.h
@@ -0,0 +1,65 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SERVICES_VIEW_MANAGER_CLIENT_CONNECTION_H_
+#define MOJO_SERVICES_VIEW_MANAGER_CLIENT_CONNECTION_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/error_handler.h"
+#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
+
+namespace mojo {
+namespace service {
+
+class ConnectionManager;
+class ViewManagerServiceImpl;
+
+// ClientConnection encapsulates the state needed for a single client connected
+// to the view manager.
+class ClientConnection {
+ public:
+  explicit ClientConnection(scoped_ptr<ViewManagerServiceImpl> service);
+  virtual ~ClientConnection();
+
+  ViewManagerServiceImpl* service() { return service_.get(); }
+  const ViewManagerServiceImpl* service() const { return service_.get(); }
+
+  ViewManagerClient* client() { return client_; }
+
+ protected:
+  void set_client(ViewManagerClient* client) { client_ = client; }
+
+ private:
+  scoped_ptr<ViewManagerServiceImpl> service_;
+  ViewManagerClient* client_;
+
+  DISALLOW_COPY_AND_ASSIGN(ClientConnection);
+};
+
+// Bindings implementation of ClientConnection.
+class DefaultClientConnection : public ClientConnection, public ErrorHandler {
+ public:
+  DefaultClientConnection(scoped_ptr<ViewManagerServiceImpl> service_impl,
+                          ConnectionManager* connection_manager);
+  ~DefaultClientConnection() override;
+
+  Binding<ViewManagerService>* binding() { return &binding_; }
+
+  void set_client_from_binding() { set_client(binding_.client()); }
+
+ private:
+  // ErrorHandler:
+  void OnConnectionError() override;
+
+  ConnectionManager* connection_manager_;
+  Binding<ViewManagerService> binding_;
+
+  DISALLOW_COPY_AND_ASSIGN(DefaultClientConnection);
+};
+
+}  // namespace service
+}  // namespace mojo
+
+#endif  // MOJO_SERVICES_VIEW_MANAGER_CLIENT_CONNECTION_H_
diff --git a/mojo/services/view_manager/connection_manager.cc b/mojo/services/view_manager/connection_manager.cc
index 24a497e..ee1a755 100644
--- a/mojo/services/view_manager/connection_manager.cc
+++ b/mojo/services/view_manager/connection_manager.cc
@@ -10,6 +10,7 @@
 #include "mojo/converters/input_events/input_events_type_converters.h"
 #include "mojo/public/cpp/application/application_connection.h"
 #include "mojo/public/interfaces/application/service_provider.mojom.h"
+#include "mojo/services/view_manager/client_connection.h"
 #include "mojo/services/view_manager/connection_manager_delegate.h"
 #include "mojo/services/view_manager/view_manager_service_impl.h"
 
@@ -19,9 +20,9 @@
 class WindowManagerInternalClientImpl
     : public InterfaceImpl<WindowManagerInternalClient> {
  public:
-  WindowManagerInternalClientImpl(WindowManagerInternalClient* real_client,
-                                  ErrorHandler* error_handler)
-      : real_client_(real_client), error_handler_(error_handler) {}
+  explicit WindowManagerInternalClientImpl(
+      WindowManagerInternalClient* real_client)
+      : real_client_(real_client) {}
   ~WindowManagerInternalClientImpl() override {}
 
   // WindowManagerInternalClient:
@@ -33,12 +34,10 @@
     real_client_->SetViewportSize(size.Pass());
   }
 
-  // InterfaceImpl:
-  void OnConnectionError() override { error_handler_->OnConnectionError(); }
+  // TODO(sky): ErrorHandling temporarily nuked. Will be fixed shortly.
 
  private:
   WindowManagerInternalClient* real_client_;
-  ErrorHandler* error_handler_;
 
   DISALLOW_COPY_AND_ASSIGN(WindowManagerInternalClientImpl);
 };
@@ -61,7 +60,7 @@
                                      ConnectionManagerDelegate* delegate)
     : app_connection_(app_connection),
       delegate_(delegate),
-      window_manager_vm_service_(nullptr),
+      window_manager_client_connection_(nullptr),
       next_connection_id_(1),
       display_manager_(
           app_connection,
@@ -96,23 +95,22 @@
   return id;
 }
 
-void ConnectionManager::OnConnectionError(ViewManagerServiceImpl* connection) {
-  if (connection == window_manager_vm_service_) {
-    window_manager_vm_service_ = nullptr;
+void ConnectionManager::OnConnectionError(ClientConnection* connection) {
+  if (connection == window_manager_client_connection_) {
+    window_manager_client_connection_ = nullptr;
     delegate_->OnLostConnectionToWindowManager();
     // Assume we've been destroyed.
     return;
   }
 
-  scoped_ptr<ViewManagerServiceImpl> connection_owner(connection);
+  scoped_ptr<ClientConnection> connection_owner(connection);
 
-  connection_map_.erase(connection->id());
+  connection_map_.erase(connection->service()->id());
 
   // Notify remaining connections so that they can cleanup.
-  for (ConnectionMap::const_iterator i = connection_map_.begin();
-       i != connection_map_.end();
-       ++i) {
-    i->second->OnWillDestroyViewManagerServiceImpl(connection);
+  for (auto& pair : connection_map_) {
+    pair.second->service()->OnWillDestroyViewManagerServiceImpl(
+        connection->service());
   }
 }
 
@@ -121,42 +119,41 @@
     const String& url,
     Id transport_view_id,
     InterfaceRequest<ServiceProvider> service_provider) {
+  std::string creator_url;
+  ConnectionMap::const_iterator it = connection_map_.find(creator_id);
+  if (it != connection_map_.end())
+    creator_url = it->second->service()->url();
+
   MessagePipe pipe;
 
   ServiceProvider* view_manager_service_provider =
       app_connection_->ConnectToApplication(url)->GetServiceProvider();
-
   view_manager_service_provider->ConnectToService(
       ViewManagerServiceImpl::Client::Name_, pipe.handle1.Pass());
-
-  std::string creator_url;
-  ConnectionMap::const_iterator it = connection_map_.find(creator_id);
-  if (it != connection_map_.end())
-    creator_url = it->second->url();
-
-  ViewManagerServiceImpl* connection =
-      new ViewManagerServiceImpl(this,
-                                 creator_id,
-                                 creator_url,
-                                 url.To<std::string>(),
-                                 ViewIdFromTransportId(transport_view_id));
-  AddConnection(connection);
-  WeakBindToPipe(connection, pipe.handle0.Pass());
-  connection->Init(service_provider.Pass());
-  OnConnectionMessagedClient(connection->id());
+  scoped_ptr<ViewManagerServiceImpl> service(
+      new ViewManagerServiceImpl(this, creator_id, creator_url, url,
+                                 ViewIdFromTransportId(transport_view_id)));
+  DefaultClientConnection* client_connection =
+      new DefaultClientConnection(service.Pass(), this);
+  client_connection->binding()->Bind(pipe.handle0.Pass());
+  client_connection->set_client_from_binding();
+  AddConnection(client_connection);
+  client_connection->service()->Init(client_connection->client(),
+                                     service_provider.Pass());
+  OnConnectionMessagedClient(client_connection->service()->id());
 }
 
 ViewManagerServiceImpl* ConnectionManager::GetConnection(
     ConnectionSpecificId connection_id) {
   ConnectionMap::iterator i = connection_map_.find(connection_id);
-  return i == connection_map_.end() ? NULL : i->second;
+  return i == connection_map_.end() ? nullptr : i->second->service();
 }
 
 ServerView* ConnectionManager::GetView(const ViewId& id) {
   if (id == root_->id())
     return root_.get();
-  ConnectionMap::iterator i = connection_map_.find(id.connection_id);
-  return i == connection_map_.end() ? NULL : i->second->GetView(id);
+  ViewManagerServiceImpl* service = GetConnection(id.connection_id);
+  return service ? service->GetView(id) : nullptr;
 }
 
 void ConnectionManager::OnConnectionMessagedClient(ConnectionSpecificId id) {
@@ -171,23 +168,19 @@
 
 const ViewManagerServiceImpl* ConnectionManager::GetConnectionWithRoot(
     const ViewId& id) const {
-  for (ConnectionMap::const_iterator i = connection_map_.begin();
-       i != connection_map_.end();
-       ++i) {
-    if (i->second->IsRoot(id))
-      return i->second;
+  for (auto& pair : connection_map_) {
+    if (pair.second->service()->IsRoot(id))
+      return pair.second->service();
   }
-  return NULL;
+  return nullptr;
 }
 
 void ConnectionManager::ProcessViewBoundsChanged(const ServerView* view,
                                                  const gfx::Rect& old_bounds,
                                                  const gfx::Rect& new_bounds) {
-  for (ConnectionMap::iterator i = connection_map_.begin();
-       i != connection_map_.end();
-       ++i) {
-    i->second->ProcessViewBoundsChanged(
-        view, old_bounds, new_bounds, IsChangeSource(i->first));
+  for (auto& pair : connection_map_) {
+    pair.second->service()->ProcessViewBoundsChanged(
+        view, old_bounds, new_bounds, IsChangeSource(pair.first));
   }
 }
 
@@ -195,11 +188,9 @@
     const ServerView* view,
     const ServerView* new_parent,
     const ServerView* old_parent) {
-  for (ConnectionMap::iterator i = connection_map_.begin();
-       i != connection_map_.end();
-       ++i) {
-    i->second->ProcessWillChangeViewHierarchy(
-        view, new_parent, old_parent, IsChangeSource(i->first));
+  for (auto& pair : connection_map_) {
+    pair.second->service()->ProcessWillChangeViewHierarchy(
+        view, new_parent, old_parent, IsChangeSource(pair.first));
   }
 }
 
@@ -207,30 +198,25 @@
     const ServerView* view,
     const ServerView* new_parent,
     const ServerView* old_parent) {
-  for (ConnectionMap::iterator i = connection_map_.begin();
-       i != connection_map_.end();
-       ++i) {
-    i->second->ProcessViewHierarchyChanged(
-        view, new_parent, old_parent, IsChangeSource(i->first));
+  for (auto& pair : connection_map_) {
+    pair.second->service()->ProcessViewHierarchyChanged(
+        view, new_parent, old_parent, IsChangeSource(pair.first));
   }
 }
 
 void ConnectionManager::ProcessViewReorder(const ServerView* view,
                                            const ServerView* relative_view,
                                            const OrderDirection direction) {
-  for (ConnectionMap::iterator i = connection_map_.begin();
-       i != connection_map_.end();
-       ++i) {
-    i->second->ProcessViewReorder(
-        view, relative_view, direction, IsChangeSource(i->first));
+  for (auto& pair : connection_map_) {
+    pair.second->service()->ProcessViewReorder(view, relative_view, direction,
+                                               IsChangeSource(pair.first));
   }
 }
 
 void ConnectionManager::ProcessViewDeleted(const ViewId& view) {
-  for (ConnectionMap::iterator i = connection_map_.begin();
-       i != connection_map_.end();
-       ++i) {
-    i->second->ProcessViewDeleted(view, IsChangeSource(i->first));
+  for (auto& pair : connection_map_) {
+    pair.second->service()->ProcessViewDeleted(view,
+                                               IsChangeSource(pair.first));
   }
 }
 
@@ -246,9 +232,9 @@
   current_change_ = NULL;
 }
 
-void ConnectionManager::AddConnection(ViewManagerServiceImpl* connection) {
-  DCHECK_EQ(0u, connection_map_.count(connection->id()));
-  connection_map_[connection->id()] = connection;
+void ConnectionManager::AddConnection(ClientConnection* connection) {
+  DCHECK_EQ(0u, connection_map_.count(connection->service()->id()));
+  connection_map_[connection->service()->id()] = connection;
 }
 
 void ConnectionManager::OnViewDestroyed(const ServerView* view) {
@@ -314,10 +300,9 @@
   if (in_destructor_)
     return;
 
-  for (ConnectionMap::iterator i = connection_map_.begin();
-       i != connection_map_.end();
-       ++i) {
-    i->second->ProcessWillChangeViewVisibility(view, IsChangeSource(i->first));
+  for (auto& pair : connection_map_) {
+    pair.second->service()->ProcessWillChangeViewVisibility(
+        view, IsChangeSource(pair.first));
   }
 }
 
@@ -326,7 +311,7 @@
     const std::string& name,
     const std::vector<uint8_t>* new_data) {
   for (auto& pair : connection_map_) {
-    pair.second->ProcessViewPropertyChanged(
+    pair.second->service()->ProcessViewPropertyChanged(
         view, name, new_data, IsChangeSource(pair.first));
   }
 }
@@ -351,20 +336,23 @@
 
 void ConnectionManager::Create(ApplicationConnection* connection,
                                InterfaceRequest<ViewManagerService> request) {
-  if (window_manager_vm_service_) {
+  if (window_manager_client_connection_) {
     VLOG(1) << "ViewManager interface requested more than once.";
     return;
   }
 
-  window_manager_vm_service_ =
-      new ViewManagerServiceImpl(this,
-                                 kInvalidConnectionId,
-                                 std::string(),
-                                 std::string("mojo:window_manager"),
-                                 RootViewId());
-  AddConnection(window_manager_vm_service_);
-  WeakBindToRequest(window_manager_vm_service_, &request);
-  window_manager_vm_service_->Init(InterfaceRequest<ServiceProvider>());
+  scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl(
+      this, kInvalidConnectionId, std::string(),
+      std::string("mojo:window_manager"), RootViewId()));
+  DefaultClientConnection* client_connection =
+      new DefaultClientConnection(service.Pass(), this);
+  client_connection->binding()->Bind(request.Pass());
+  client_connection->set_client_from_binding();
+  window_manager_client_connection_ = client_connection;
+  AddConnection(window_manager_client_connection_);
+  window_manager_client_connection_->service()->Init(
+      window_manager_client_connection_->client(),
+      InterfaceRequest<ServiceProvider>());
 }
 
 void ConnectionManager::Create(
@@ -375,14 +363,9 @@
     return;
   }
 
-  wm_internal_client_impl_.reset(
-      new WindowManagerInternalClientImpl(this, this));
+  wm_internal_client_impl_.reset(new WindowManagerInternalClientImpl(this));
   WeakBindToRequest(wm_internal_client_impl_.get(), &request);
 }
 
-void ConnectionManager::OnConnectionError() {
-  delegate_->OnLostConnectionToWindowManager();
-}
-
 }  // namespace service
 }  // namespace mojo
diff --git a/mojo/services/view_manager/connection_manager.h b/mojo/services/view_manager/connection_manager.h
index 364ed19..c0edef6 100644
--- a/mojo/services/view_manager/connection_manager.h
+++ b/mojo/services/view_manager/connection_manager.h
@@ -9,6 +9,7 @@
 #include <set>
 
 #include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
 #include "mojo/public/cpp/application/interface_factory.h"
 #include "mojo/public/cpp/bindings/array.h"
 #include "mojo/public/cpp/bindings/error_handler.h"
@@ -25,18 +26,17 @@
 
 namespace service {
 
+class ClientConnection;
 class ConnectionManagerDelegate;
 class ViewManagerServiceImpl;
 class WindowManagerInternalClientImpl;
 
 // ConnectionManager manages the set of connections to the ViewManager (all the
 // ViewManagerServiceImpls) as well as providing the root of the hierarchy.
-class ConnectionManager
-    : public ServerViewDelegate,
-      public WindowManagerInternalClient,
-      public InterfaceFactory<ViewManagerService>,
-      public InterfaceFactory<WindowManagerInternalClient>,
-      public ErrorHandler {
+class ConnectionManager : public ServerViewDelegate,
+                          public WindowManagerInternalClient,
+                          public InterfaceFactory<ViewManagerService>,
+                          public InterfaceFactory<WindowManagerInternalClient> {
  public:
   // Create when a ViewManagerServiceImpl is about to make a change. Ensures
   // clients are notified correctly.
@@ -79,7 +79,7 @@
   ConnectionSpecificId GetAndAdvanceNextConnectionId();
 
   // Invoked when a ViewManagerServiceImpl's connection encounters an error.
-  void OnConnectionError(ViewManagerServiceImpl* connection);
+  void OnConnectionError(ClientConnection* connection);
 
   // See description of ViewManagerService::Embed() for details. This assumes
   // |transport_view_id| is valid.
@@ -136,7 +136,7 @@
   void ProcessViewDeleted(const ViewId& view);
 
  private:
-  typedef std::map<ConnectionSpecificId, ViewManagerServiceImpl*> ConnectionMap;
+  typedef std::map<ConnectionSpecificId, ClientConnection*> ConnectionMap;
 
   // Invoked when a connection is about to make a change.  Subsequently followed
   // by FinishChange() once the change is done.
@@ -155,7 +155,7 @@
   }
 
   // Adds |connection| to internal maps.
-  void AddConnection(ViewManagerServiceImpl* connection);
+  void AddConnection(ClientConnection* connection);
 
   // Overridden from ServerViewDelegate:
   void OnViewDestroyed(const ServerView* view) override;
@@ -190,17 +190,14 @@
   void Create(ApplicationConnection* connection,
               InterfaceRequest<WindowManagerInternalClient> request) override;
 
-  // ErrorHandler:
-  void OnConnectionError() override;
-
   ApplicationConnection* app_connection_;
 
   ConnectionManagerDelegate* delegate_;
 
-  // The ViewManager implementation provided to the initial connection (the
-  // WindowManager).
-  // NOTE: |window_manager_vm_service_| is also in |connection_map_|.
-  ViewManagerServiceImpl* window_manager_vm_service_;
+  // The ClientConnection containing the ViewManagerService implementation
+  // provided to the initial connection (the WindowManager).
+  // NOTE: |window_manager_client_connection_| is also in |connection_map_|.
+  ClientConnection* window_manager_client_connection_;
 
   // ID to use for next ViewManagerServiceImpl.
   ConnectionSpecificId next_connection_id_;
diff --git a/mojo/services/view_manager/view_manager_service_impl.cc b/mojo/services/view_manager/view_manager_service_impl.cc
index 8c8eee4..c5318f1 100644
--- a/mojo/services/view_manager/view_manager_service_impl.cc
+++ b/mojo/services/view_manager/view_manager_service_impl.cc
@@ -27,7 +27,8 @@
       id_(connection_manager_->GetAndAdvanceNextConnectionId()),
       url_(url),
       creator_id_(creator_id),
-      creator_url_(creator_url) {
+      creator_url_(creator_url),
+      client_(nullptr) {
   CHECK(GetView(root_id));
   root_.reset(new ViewId(root_id));
   if (root_id == RootViewId())
@@ -41,7 +42,10 @@
 }
 
 void ViewManagerServiceImpl::Init(
+    ViewManagerClient* client,
     InterfaceRequest<ServiceProvider> service_provider) {
+  DCHECK(!client_);
+  client_ = client;
   std::vector<const ServerView*> to_send;
   if (root_.get())
     GetUnknownViewsFrom(GetView(*root_), &to_send);
@@ -49,11 +53,8 @@
   MessagePipe pipe;
   connection_manager_->wm_internal()->CreateWindowManagerForViewManagerClient(
       id_, pipe.handle1.Pass());
-  client()->OnEmbed(id_,
-                    creator_url_,
-                    ViewToViewData(to_send.front()),
-                    service_provider.Pass(),
-                    pipe.handle0.Pass());
+  client->OnEmbed(id_, creator_url_, ViewToViewData(to_send.front()),
+                  service_provider.Pass(), pipe.handle0.Pass());
 }
 
 const ServerView* ViewManagerServiceImpl::GetView(const ViewId& id) const {
@@ -216,10 +217,6 @@
   NotifyDrawnStateChanged(view, view_target_drawn_state);
 }
 
-void ViewManagerServiceImpl::OnConnectionError() {
-  connection_manager_->OnConnectionError(this);
-}
-
 bool ViewManagerServiceImpl::IsViewKnown(const ServerView* view) const {
   return known_views_.count(ViewIdToTransportId(view->id())) > 0;
 }
diff --git a/mojo/services/view_manager/view_manager_service_impl.h b/mojo/services/view_manager/view_manager_service_impl.h
index 967b766..7c26c3a 100644
--- a/mojo/services/view_manager/view_manager_service_impl.h
+++ b/mojo/services/view_manager/view_manager_service_impl.h
@@ -28,10 +28,12 @@
 class ConnectionManager;
 class ServerView;
 
-// Manages a connection from the client.
-class ViewManagerServiceImpl
-    : public InterfaceImpl<ViewManagerService>,
-      public AccessPolicyDelegate {
+// An instance of ViewManagerServiceImpl is created for every ViewManagerService
+// request. ViewManagerServiceImpl tracks all the state and views created by a
+// client. ViewManagerServiceImpl coordinates with ConnectionManager to update
+// the client (and internal state) as necessary.
+class ViewManagerServiceImpl : public ViewManagerService,
+                               public AccessPolicyDelegate {
  public:
   using ViewIdSet = base::hash_set<Id>;
 
@@ -42,14 +44,17 @@
                          const ViewId& root_id);
   ~ViewManagerServiceImpl() override;
 
-  // Called after bound. |service_provider| is the ServiceProvider to pass to
-  // the client via OnEmbed().
-  void Init(InterfaceRequest<ServiceProvider> service_provider);
+  // |service_provider| is the ServiceProvider to pass to the client via
+  // OnEmbed().
+  void Init(ViewManagerClient* client,
+            InterfaceRequest<ServiceProvider> service_provider);
 
   ConnectionSpecificId id() const { return id_; }
   ConnectionSpecificId creator_id() const { return creator_id_; }
   const std::string& url() const { return url_; }
 
+  ViewManagerClient* client() { return client_; }
+
   // Returns the View with the specified id.
   ServerView* GetView(const ViewId& id) {
     return const_cast<ServerView*>(
@@ -92,11 +97,6 @@
   void ProcessViewPropertiesChanged(const ServerView* view,
                                     bool originated_change);
 
-  // TODO(sky): move this to private section (currently can't because of
-  // bindings).
-  // InterfaceImp overrides:
-  void OnConnectionError() override;
-
  private:
   typedef std::map<ConnectionSpecificId, ServerView*> ViewMap;
 
@@ -202,6 +202,8 @@
   // The URL of the app that embedded the app this connection was created for.
   const std::string creator_url_;
 
+  ViewManagerClient* client_;
+
   scoped_ptr<AccessPolicy> access_policy_;
 
   // The views created by this connection. This connection owns these objects.