Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_SERVICE_CONNECTOR_H_ | 5 #ifndef MOJO_SHELL_SERVICE_CONNECTOR_H_ |
| 6 #define MOJO_SHELL_SERVICE_CONNECTOR_H_ | 6 #define MOJO_SHELL_SERVICE_CONNECTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 // Sets the default Loader to be used if not overridden by SetLoaderForURL(). | 34 // Sets the default Loader to be used if not overridden by SetLoaderForURL(). |
| 35 // Does not take ownership of |loader|. | 35 // Does not take ownership of |loader|. |
| 36 void set_default_loader(Loader* loader) { default_loader_ = loader; } | 36 void set_default_loader(Loader* loader) { default_loader_ = loader; } |
| 37 // Sets a Loader to be used for a specific url. | 37 // Sets a Loader to be used for a specific url. |
| 38 // Does not take ownership of |loader|. | 38 // Does not take ownership of |loader|. |
| 39 void SetLoaderForURL(Loader* loader, const GURL& gurl); | 39 void SetLoaderForURL(Loader* loader, const GURL& gurl); |
| 40 // Returns the Loader to use for a url (using default if not overridden.) | 40 // Returns the Loader to use for a url (using default if not overridden.) |
| 41 Loader* GetLoaderForURL(const GURL& gurl); | 41 Loader* GetLoaderForURL(const GURL& gurl); |
| 42 // Loads a service if necessary and establishes a new client connection. | 42 // Loads a service if necessary and establishes a new client connection. |
| 43 void Connect(const GURL& url, ScopedMessagePipeHandle client_handle); | 43 void Connect(const GURL& url, ScopedMessagePipeHandle client_handle); |
| 44 // Returns true if there is a ServiceFactory for this URL. | |
| 45 bool HasFactoryForURL(const GURL& url) const; | |
|
darin (slow to review)
2014/02/06 05:00:46
nit: the service factory is a private implementati
| |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 class ServiceFactory; | 48 class ServiceFactory; |
| 47 | 49 |
| 50 // Removes a ServiceFactory when it no longer has any connections. | |
| 51 void RemoveServiceFactory(ServiceFactory* service_factory); | |
| 52 | |
| 48 Loader* default_loader_; | 53 Loader* default_loader_; |
| 49 typedef std::map<GURL, ServiceFactory*> ServiceFactoryMap; | 54 typedef std::map<GURL, ServiceFactory*> ServiceFactoryMap; |
| 50 ServiceFactoryMap url_to_service_factory_; | 55 ServiceFactoryMap url_to_service_factory_; |
| 51 typedef std::map<GURL, Loader*> LoaderMap; | 56 typedef std::map<GURL, Loader*> LoaderMap; |
| 52 LoaderMap url_to_loader_; | 57 LoaderMap url_to_loader_; |
| 53 DISALLOW_COPY_AND_ASSIGN(ServiceConnector); | 58 DISALLOW_COPY_AND_ASSIGN(ServiceConnector); |
| 54 }; | 59 }; |
| 55 | 60 |
| 56 } // namespace shell | 61 } // namespace shell |
| 57 } // namespace mojo | 62 } // namespace mojo |
| 58 | 63 |
| 59 #endif // MOJO_SHELL_SERVICE_CONNECTOR_H_ | 64 #endif // MOJO_SHELL_SERVICE_CONNECTOR_H_ |
| OLD | NEW |