Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: mojo/services/view_manager/client_connection.h

Issue 721243003: Changes ViewManagerServiceImpl so that it no longer subclasses InterfaceImpl (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: format Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/services/view_manager/client_connection.h
diff --git a/mojo/services/view_manager/client_connection.h b/mojo/services/view_manager/client_connection.h
new file mode 100644
index 0000000000000000000000000000000000000000..5759d389bc050501b66c727265c408bee6eb88bb
--- /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(ConnectionManager* connection_manager,
+ scoped_ptr<ViewManagerServiceImpl> service_impl);
msw 2014/11/14 01:42:18 nit: make this match ClientConnection's |service|
sky 2014/11/14 20:56:03 Done.
+ ~DefaultClientConnection() override;
+
+ Binding<ViewManagerService>* binding() { return &binding_; }
msw 2014/11/14 01:42:18 nit: consider having two ctors (or two helper Bind
sky 2014/11/14 20:56:03 I'll do that in a subsequent patch when the delega
+
+ void SetClient() { set_client(binding_.client()); }
msw 2014/11/14 01:42:18 nit: consider set_client_from_binding()
sky 2014/11/14 20:56:03 Done.
+
+ private:
+ // InterfaceBindingDelegate:
msw 2014/11/14 01:42:18 nit: ErrorHandler
sky 2014/11/14 20:56:03 Done.
+ 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_

Powered by Google App Engine
This is Rietveld 408576698