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