Chromium Code Reviews| Index: chrome/browser/media/router/discovery/dial/dial_registry_factory.h |
| diff --git a/chrome/browser/media/router/discovery/dial/dial_registry_factory.h b/chrome/browser/media/router/discovery/dial/dial_registry_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..059697176803c175d4870fcff801d5e16fd779cd |
| --- /dev/null |
| +++ b/chrome/browser/media/router/discovery/dial/dial_registry_factory.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_FACTORY_H_ |
| +#define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_FACTORY_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/singleton.h" |
| +#include "components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h" |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} |
| + |
| +namespace media_router { |
| + |
| +class DialRegistry; |
| + |
| +// A factory that lazily returns a DialRegistry implementation for a given |
| +// BrowserContext. |
| +class DialRegistryFactory : public RefcountedBrowserContextKeyedServiceFactory { |
| + public: |
| + static scoped_refptr<DialRegistry> GetForBrowserContext( |
|
mark a. foltz
2017/03/18 18:04:58
If DialRegistry is not profile-keyed, this could j
zhaobin
2017/03/22 02:48:45
Done.
|
| + content::BrowserContext* context); |
| + |
| + static DialRegistryFactory* GetInstance(); |
| + |
| + private: |
| + friend struct base::DefaultSingletonTraits<DialRegistryFactory>; |
| + |
| + DialRegistryFactory(); |
| + ~DialRegistryFactory() override; |
| + |
| + // BrowserContextKeyedServiceFactory interface. |
| + content::BrowserContext* GetBrowserContextToUse( |
| + content::BrowserContext* context) const override; |
| + |
| + scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( |
| + content::BrowserContext* context) const override; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DialRegistryFactory); |
| +}; |
| + |
| +} // namespace media_router |
| + |
| +#endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_REGISTRY_FACTORY_H_ |