OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_ANDROID_BLIMP_BLIMP_CLIENT_CONTEXT_FACTORY_H_ | |
6 #define CHROME_BROWSER_ANDROID_BLIMP_BLIMP_CLIENT_CONTEXT_FACTORY_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | |
10 | |
11 namespace base { | |
12 template <typename T> | |
13 struct DefaultSingletonTraits; | |
14 } // namespace base | |
15 | |
16 namespace blimp { | |
17 namespace client { | |
18 class BlimpClientContext; | |
19 } // namespace client | |
20 } // namespace blimp | |
21 | |
22 namespace content { | |
23 class BrowserContext; | |
24 } // namespace content | |
25 | |
26 // BlimpClientContextFactory is the main client class for interactive with | |
27 // blimp. | |
28 class BlimpClientContextFactory : public BrowserContextKeyedServiceFactory { | |
29 public: | |
30 // Returns singleton instance of BlimpClientContextFactory. | |
31 static BlimpClientContextFactory* GetInstance(); | |
32 | |
33 // Returns the BlimpClientContext associated with |context| or creates a new | |
34 // one if it doesn't exist. | |
35 static blimp::client::BlimpClientContext* GetForBrowserContext( | |
36 content::BrowserContext* context); | |
37 | |
38 private: | |
39 friend struct base::DefaultSingletonTraits<BlimpClientContextFactory>; | |
40 | |
41 BlimpClientContextFactory(); | |
42 ~BlimpClientContextFactory() override; | |
43 | |
44 // BrowserContextKeyedServiceFactory overrides: | |
45 KeyedService* BuildServiceInstanceFor( | |
46 content::BrowserContext* context) const override; | |
47 content::BrowserContext* GetBrowserContextToUse( | |
48 content::BrowserContext* context) const override; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextFactory); | |
51 }; | |
52 | |
53 #endif // CHROME_BROWSER_ANDROID_BLIMP_BLIMP_CLIENT_CONTEXT_FACTORY_H_ | |
OLD | NEW |