| 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_SERVICE_MANAGER_SERVICE_MANAGER_H_ | 5 #ifndef MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_ |
| 6 #define MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_ | 6 #define MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/gtest_prod_util.h" | |
| 13 #include "mojo/public/shell/shell.mojom.h" | 12 #include "mojo/public/shell/shell.mojom.h" |
| 14 #include "mojo/service_manager/service_manager_export.h" | |
| 15 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 16 | 14 |
| 17 namespace content { | |
| 18 class MojoTest; | |
| 19 } | |
| 20 | |
| 21 namespace mojo { | 15 namespace mojo { |
| 22 | 16 |
| 23 class ServiceLoader; | 17 class ServiceLoader; |
| 24 | 18 |
| 25 class MOJO_SERVICE_MANAGER_EXPORT ServiceManager { | 19 class ServiceManager { |
| 26 public: | 20 public: |
| 27 // API for testing. | 21 // API for testing. |
| 28 class MOJO_SERVICE_MANAGER_EXPORT TestAPI { | 22 class TestAPI { |
| 29 private: | 23 private: |
| 30 friend class ServiceManagerTest; | 24 friend class ServiceManagerTest; |
| 31 friend class content::MojoTest; | |
| 32 | |
| 33 explicit TestAPI(ServiceManager* manager) : manager_(manager) {} | 25 explicit TestAPI(ServiceManager* manager) : manager_(manager) {} |
| 34 // Returns true if the shared instance has been created. | |
| 35 static bool HasCreatedInstance(); | |
| 36 // Returns true if there is a ServiceFactory for this URL. | 26 // Returns true if there is a ServiceFactory for this URL. |
| 37 bool HasFactoryForURL(const GURL& url) const; | 27 bool HasFactoryForURL(const GURL& url) const; |
| 38 | 28 |
| 39 ServiceManager* manager_; | 29 ServiceManager* manager_; |
| 40 }; | 30 }; |
| 41 | 31 |
| 42 ServiceManager(); | 32 ServiceManager(); |
| 43 ~ServiceManager(); | 33 ~ServiceManager(); |
| 44 | 34 |
| 45 // Returns a shared instance, creating it if necessary. | 35 // Returns a shared instance, creating it if necessary. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 66 typedef std::map<GURL, ServiceFactory*> ServiceFactoryMap; | 56 typedef std::map<GURL, ServiceFactory*> ServiceFactoryMap; |
| 67 ServiceFactoryMap url_to_service_factory_; | 57 ServiceFactoryMap url_to_service_factory_; |
| 68 typedef std::map<GURL, ServiceLoader*> LoaderMap; | 58 typedef std::map<GURL, ServiceLoader*> LoaderMap; |
| 69 LoaderMap url_to_loader_; | 59 LoaderMap url_to_loader_; |
| 70 DISALLOW_COPY_AND_ASSIGN(ServiceManager); | 60 DISALLOW_COPY_AND_ASSIGN(ServiceManager); |
| 71 }; | 61 }; |
| 72 | 62 |
| 73 } // namespace mojo | 63 } // namespace mojo |
| 74 | 64 |
| 75 #endif // MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_ | 65 #endif // MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_ |
| OLD | NEW |