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

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

Issue 1918403002: [Reland] [Media Router Tests] Add tests for MediaRouterFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use unique_tpr Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/media/router/media_router_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/lazy_instance.h" 9 #include "base/lazy_instance.h"
9 #include "base/macros.h" 10 #include "base/macros.h"
10 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 11 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
11 12
12 namespace content { 13 namespace content {
13 class BrowserContext; 14 class BrowserContext;
14 } 15 }
15 16
16 namespace media_router { 17 namespace media_router {
17 18
18 class MediaRouter; 19 class MediaRouter;
19 20
20 // A factory that lazily returns a MediaRouter implementation for a given 21 // A factory that lazily returns a MediaRouter implementation for a given
21 // BrowserContext. 22 // BrowserContext.
22 class MediaRouterFactory : public BrowserContextKeyedServiceFactory { 23 class MediaRouterFactory : public BrowserContextKeyedServiceFactory {
23 public: 24 public:
24 static MediaRouter* GetApiForBrowserContext(content::BrowserContext* context); 25 static MediaRouter* GetApiForBrowserContext(content::BrowserContext* context);
25 26
26 protected: 27 protected:
27 // We override the shutdown method for the factory to give the Media Router a 28 // We override the shutdown method for the factory to give the Media Router a
28 // chance to remove off the record media routes. 29 // chance to remove off the record media routes.
29 void BrowserContextShutdown(content::BrowserContext* context) override; 30 void BrowserContextShutdown(content::BrowserContext* context) override;
30 31
31 private: 32 private:
32 friend struct base::DefaultLazyInstanceTraits<MediaRouterFactory>; 33 friend struct base::DefaultLazyInstanceTraits<MediaRouterFactory>;
34 FRIEND_TEST_ALL_PREFIXES(MediaRouterFactoryTest,
35 OffTheRecordBrowserContextShutdown);
33 36
34 MediaRouterFactory(); 37 MediaRouterFactory();
35 ~MediaRouterFactory() override; 38 ~MediaRouterFactory() override;
36 39
40 // Exposed for testing.
41 static MediaRouterFactory* GetMediaRouterFactoryForTest();
42
37 // BrowserContextKeyedServiceFactory interface. 43 // BrowserContextKeyedServiceFactory interface.
38 content::BrowserContext* GetBrowserContextToUse( 44 content::BrowserContext* GetBrowserContextToUse(
39 content::BrowserContext* context) const override; 45 content::BrowserContext* context) const override;
40 46
41 KeyedService* BuildServiceInstanceFor( 47 KeyedService* BuildServiceInstanceFor(
42 content::BrowserContext* context) const override; 48 content::BrowserContext* context) const override;
43 49
44 DISALLOW_COPY_AND_ASSIGN(MediaRouterFactory); 50 DISALLOW_COPY_AND_ASSIGN(MediaRouterFactory);
45 }; 51 };
46 52
47 } // namespace media_router 53 } // namespace media_router
48 54
49 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_FACTORY_H_ 55 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_FACTORY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/router/media_router_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698