Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: chrome/browser/media/router/media_router_factory.h

Issue 2294973002: Create MediaRouterActionController and MediaRouterUIService (Closed)
Patch Set: Address Derek and Mark's comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_FACTORY_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_FACTORY_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_FACTORY_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_FACTORY_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 11 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
12 12
13 namespace content { 13 namespace content {
14 class BrowserContext; 14 class BrowserContext;
15 } 15 }
16 16
17 namespace media_router { 17 namespace media_router {
18 18
19 class MediaRouter; 19 class MediaRouter;
20 20
21 // A factory that lazily returns a MediaRouter implementation for a given 21 // A factory that lazily returns a MediaRouter implementation for a given
22 // BrowserContext. 22 // BrowserContext.
23 class MediaRouterFactory : public BrowserContextKeyedServiceFactory { 23 class MediaRouterFactory : public BrowserContextKeyedServiceFactory {
24 public: 24 public:
25 static MediaRouter* GetApiForBrowserContext(content::BrowserContext* context); 25 static MediaRouter* GetApiForBrowserContext(content::BrowserContext* context);
26 26
27 static MediaRouterFactory* GetInstance();
28
27 protected: 29 protected:
28 // We override the shutdown method for the factory to give the Media Router a 30 // We override the shutdown method for the factory to give the Media Router a
29 // chance to remove incognito media routes. 31 // chance to remove incognito media routes.
30 void BrowserContextShutdown(content::BrowserContext* context) override; 32 void BrowserContextShutdown(content::BrowserContext* context) override;
31 33
32 private: 34 private:
33 friend struct base::DefaultLazyInstanceTraits<MediaRouterFactory>; 35 friend struct base::DefaultLazyInstanceTraits<MediaRouterFactory>;
34 FRIEND_TEST_ALL_PREFIXES(MediaRouterFactoryTest, 36 FRIEND_TEST_ALL_PREFIXES(MediaRouterFactoryTest,
35 IncognitoBrowserContextShutdown); 37 IncognitoBrowserContextShutdown);
36 38
37 MediaRouterFactory(); 39 MediaRouterFactory();
38 ~MediaRouterFactory() override; 40 ~MediaRouterFactory() override;
39 41
40 // Exposed for testing.
41 static MediaRouterFactory* GetMediaRouterFactoryForTest();
42
43 // BrowserContextKeyedServiceFactory interface. 42 // BrowserContextKeyedServiceFactory interface.
44 content::BrowserContext* GetBrowserContextToUse( 43 content::BrowserContext* GetBrowserContextToUse(
45 content::BrowserContext* context) const override; 44 content::BrowserContext* context) const override;
46 45
47 KeyedService* BuildServiceInstanceFor( 46 KeyedService* BuildServiceInstanceFor(
48 content::BrowserContext* context) const override; 47 content::BrowserContext* context) const override;
49 48
50 DISALLOW_COPY_AND_ASSIGN(MediaRouterFactory); 49 DISALLOW_COPY_AND_ASSIGN(MediaRouterFactory);
51 }; 50 };
52 51
53 } // namespace media_router 52 } // namespace media_router
54 53
55 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_FACTORY_H_ 54 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698