OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_CONNECTION_H_ |
| 6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_CONNECTION_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 13 #include "mojo/services/view_manager/root_node_manager.h" |
| 14 #include "mojo/services/view_manager/root_view_manager_delegate.h" |
| 15 #include "mojo/services/view_manager/view_manager_export.h" |
| 16 |
| 17 namespace mojo { |
| 18 |
| 19 class ServiceProvider; |
| 20 |
| 21 namespace view_manager { |
| 22 namespace service { |
| 23 |
| 24 #if defined(OS_WIN) |
| 25 // Equivalent of NON_EXPORTED_BASE which does not work with the template snafu |
| 26 // below. |
| 27 #pragma warning(push) |
| 28 #pragma warning(disable : 4275) |
| 29 #endif |
| 30 |
| 31 // Used to create the initial IViewManagerClient. Doesn't initiate the Connect() |
| 32 // until the WindowTreeHost has been created. |
| 33 class MOJO_VIEW_MANAGER_EXPORT ViewManagerInitConnection |
| 34 : public InterfaceImpl<IViewManagerInit>, |
| 35 public RootViewManagerDelegate { |
| 36 public: |
| 37 explicit ViewManagerInitConnection(ServiceProvider* service_provider); |
| 38 virtual ~ViewManagerInitConnection(); |
| 39 |
| 40 private: |
| 41 struct ConnectParams { |
| 42 ConnectParams(); |
| 43 ~ConnectParams(); |
| 44 |
| 45 std::string url; |
| 46 Callback<void(bool)> callback; |
| 47 }; |
| 48 |
| 49 void MaybeConnect(const std::string& url, |
| 50 const Callback<void(bool)>& callback); |
| 51 |
| 52 // IViewManagerInit overrides: |
| 53 virtual void Connect(const String& url, |
| 54 const Callback<void(bool)>& callback) OVERRIDE; |
| 55 |
| 56 // RootViewManagerDelegate overrides: |
| 57 virtual void OnRootViewManagerWindowTreeHostCreated() OVERRIDE; |
| 58 |
| 59 ServiceProvider* service_provider_; |
| 60 |
| 61 RootNodeManager root_node_manager_; |
| 62 |
| 63 // Parameters passed to Connect(). If non-null Connect() has been invoked. |
| 64 scoped_ptr<ConnectParams> connect_params_; |
| 65 |
| 66 bool is_tree_host_ready_; |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(ViewManagerInitConnection); |
| 69 }; |
| 70 |
| 71 #if defined(OS_WIN) |
| 72 #pragma warning(pop) |
| 73 #endif |
| 74 |
| 75 } // namespace service |
| 76 } // namespace view_manager |
| 77 } // namespace mojo |
| 78 |
| 79 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_CONNECTION_H_ |
OLD | NEW |