OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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_SHELL_SERVICE_MANAGER_H_ |
| 6 #define MOJO_SHELL_SERVICE_MANAGER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "mojo/public/system/core_cpp.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 namespace mojo { |
| 15 namespace shell { |
| 16 |
| 17 class Context; |
| 18 |
| 19 class ServiceManager { |
| 20 public: |
| 21 class Loader { |
| 22 public: |
| 23 virtual ~Loader(); |
| 24 virtual void Load(const GURL& url, |
| 25 ServiceManager* manager, |
| 26 ScopedMessagePipeHandle service_handle) = 0; |
| 27 protected: |
| 28 Loader(); |
| 29 }; |
| 30 |
| 31 explicit ServiceManager(Context* context); |
| 32 ~ServiceManager(); |
| 33 |
| 34 void SetLoaderForURL(Loader* loader, const GURL& gurl); |
| 35 Loader* GetLoaderForURL(const GURL& gurl); |
| 36 void Connect(const GURL& url, ScopedMessagePipeHandle client_handle); |
| 37 |
| 38 private: |
| 39 class Service; |
| 40 class DynamicLoader; |
| 41 |
| 42 Context* context_; |
| 43 scoped_ptr<Loader> default_loader_; |
| 44 typedef std::map<GURL, Service*> ServiceMap; |
| 45 ServiceMap url_to_service_; |
| 46 typedef std::map<GURL, Loader*> LoaderMap; |
| 47 LoaderMap url_to_loader_; |
| 48 DISALLOW_COPY_AND_ASSIGN(ServiceManager); |
| 49 }; |
| 50 |
| 51 } // namespace shell |
| 52 } // namespace mojo |
| 53 |
| 54 #endif // MOJO_SHELL_SERVICE_MANAGER_H_ |
OLD | NEW |