| 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_SHELL_VIEW_MANAGER_LOADER_H_ | 5 #ifndef MOJO_SHELL_VIEW_MANAGER_LOADER_H_ |
| 6 #define MOJO_SHELL_VIEW_MANAGER_LOADER_H_ | 6 #define MOJO_SHELL_VIEW_MANAGER_LOADER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
| 11 #include "mojo/public/cpp/application/interface_provider.h" |
| 11 #include "mojo/service_manager/service_loader.h" | 12 #include "mojo/service_manager/service_loader.h" |
| 13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 12 | 14 |
| 13 namespace mojo { | 15 namespace mojo { |
| 14 | 16 |
| 15 class Application; | 17 class Application; |
| 16 | 18 |
| 17 namespace shell { | 19 namespace shell { |
| 18 | 20 |
| 19 // ServiceLoader responsible for creating connections to the ViewManager. | 21 // ServiceLoader responsible for creating connections to the ViewManager. |
| 20 class ViewManagerLoader : public ServiceLoader, public ApplicationDelegate { | 22 class ViewManagerLoader |
| 23 : public ServiceLoader, |
| 24 public ApplicationDelegate, |
| 25 public InterfaceProvider<view_manager::ViewManagerInitService> { |
| 21 public: | 26 public: |
| 22 ViewManagerLoader(); | 27 ViewManagerLoader(); |
| 23 virtual ~ViewManagerLoader(); | 28 virtual ~ViewManagerLoader(); |
| 24 | 29 |
| 25 private: | 30 private: |
| 26 // ServiceLoader overrides: | 31 // ServiceLoader overrides: |
| 27 virtual void LoadService( | 32 virtual void LoadService( |
| 28 ServiceManager* manager, | 33 ServiceManager* manager, |
| 29 const GURL& url, | 34 const GURL& url, |
| 30 ScopedMessagePipeHandle shell_handle) OVERRIDE; | 35 ScopedMessagePipeHandle shell_handle) OVERRIDE; |
| 31 virtual void OnServiceError(ServiceManager* manager, | 36 virtual void OnServiceError(ServiceManager* manager, |
| 32 const GURL& url) OVERRIDE; | 37 const GURL& url) OVERRIDE; |
| 33 | 38 |
| 34 // ApplicationDelegate overrides. | 39 // ApplicationDelegate overrides. |
| 35 virtual bool ConfigureIncomingConnection( | 40 virtual bool ConfigureIncomingConnection( |
| 36 mojo::ApplicationConnection* connection) MOJO_OVERRIDE; | 41 mojo::ApplicationConnection* connection) OVERRIDE; |
| 42 |
| 43 // InterfaceProvider<view_manager::ViewManagerInitService> overrides. |
| 44 virtual void BindToRequest( |
| 45 ApplicationConnection* connection, |
| 46 InterfaceRequest<view_manager::ViewManagerInitService> request) OVERRIDE; |
| 37 | 47 |
| 38 ScopedVector<Application> apps_; | 48 ScopedVector<Application> apps_; |
| 39 | 49 |
| 40 DISALLOW_COPY_AND_ASSIGN(ViewManagerLoader); | 50 DISALLOW_COPY_AND_ASSIGN(ViewManagerLoader); |
| 41 }; | 51 }; |
| 42 | 52 |
| 43 } // namespace shell | 53 } // namespace shell |
| 44 } // namespace mojo | 54 } // namespace mojo |
| 45 | 55 |
| 46 #endif // MOJO_SHELL_VIEW_MANAGER_LOADER_H_ | 56 #endif // MOJO_SHELL_VIEW_MANAGER_LOADER_H_ |
| OLD | NEW |