Index: mojo/services/view_manager/view_manager_init_connection.h |
diff --git a/mojo/services/view_manager/view_manager_init_connection.h b/mojo/services/view_manager/view_manager_init_connection.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0cedc637eab2535c32d5e59617e3dbf85d808b83 |
--- /dev/null |
+++ b/mojo/services/view_manager/view_manager_init_connection.h |
@@ -0,0 +1,79 @@ |
+// 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_VIEW_MANAGER_INIT_CONNECTION_H_ |
+#define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_CONNECTION_H_ |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
+#include "mojo/services/view_manager/root_node_manager.h" |
+#include "mojo/services/view_manager/root_view_manager_delegate.h" |
+#include "mojo/services/view_manager/view_manager_export.h" |
+ |
+namespace mojo { |
+ |
+class ServiceProvider; |
+ |
+namespace view_manager { |
+namespace service { |
+ |
+#if defined(OS_WIN) |
+// Equivalent of NON_EXPORTED_BASE which does not work with the template snafu |
+// below. |
+#pragma warning(push) |
+#pragma warning(disable : 4275) |
+#endif |
+ |
+// Used to create the initial IViewManagerClient. Doesn't initiate the Connect() |
+// until the WindowTreeHost has been created. |
+class MOJO_VIEW_MANAGER_EXPORT ViewManagerInitConnection |
+ : public InterfaceImpl<IViewManagerInit>, |
+ public RootViewManagerDelegate { |
+ public: |
+ explicit ViewManagerInitConnection(ServiceProvider* service_provider); |
+ virtual ~ViewManagerInitConnection(); |
+ |
+ private: |
+ struct ConnectParams { |
+ ConnectParams(); |
+ ~ConnectParams(); |
+ |
+ std::string url; |
+ Callback<void(bool)> callback; |
+ }; |
+ |
+ void MaybeConnect(const std::string& url, |
+ const Callback<void(bool)>& callback); |
+ |
+ // IViewManagerInit overrides: |
+ virtual void Connect(const String& url, |
+ const Callback<void(bool)>& callback) OVERRIDE; |
+ |
+ // RootViewManagerDelegate overrides: |
+ virtual void OnRootViewManagerWindowTreeHostCreated() OVERRIDE; |
+ |
+ ServiceProvider* service_provider_; |
+ |
+ RootNodeManager root_node_manager_; |
+ |
+ // Parameters passed to Connect(). If non-null Connect() has been invoked. |
+ scoped_ptr<ConnectParams> connect_params_; |
+ |
+ bool is_tree_host_ready_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ViewManagerInitConnection); |
+}; |
+ |
+#if defined(OS_WIN) |
+#pragma warning(pop) |
+#endif |
+ |
+} // namespace service |
+} // namespace view_manager |
+} // namespace mojo |
+ |
+#endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_CONNECTION_H_ |