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