Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors |
reillyg | 551eaa4 | 2015-11-11 01:29:21 | [diff] [blame] | 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_USB_USB_CHOOSER_CONTEXT_FACTORY_H_ |
| 6 | #define CHROME_BROWSER_USB_USB_CHOOSER_CONTEXT_FACTORY_H_ |
| 7 | |
Mikel Astiz | 0eb80d65 | 2023-05-30 19:44:41 | [diff] [blame] | 8 | #include "base/no_destructor.h" |
Ryan Sultanem | 93f33641 | 2022-08-22 17:47:43 | [diff] [blame] | 9 | #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
reillyg | 551eaa4 | 2015-11-11 01:29:21 | [diff] [blame] | 10 | |
| 11 | class UsbChooserContext; |
| 12 | class Profile; |
| 13 | |
Ryan Sultanem | 93f33641 | 2022-08-22 17:47:43 | [diff] [blame] | 14 | class UsbChooserContextFactory : public ProfileKeyedServiceFactory { |
reillyg | 551eaa4 | 2015-11-11 01:29:21 | [diff] [blame] | 15 | public: |
| 16 | static UsbChooserContext* GetForProfile(Profile* profile); |
Andy Paicu | fa96c83 | 2021-06-24 16:17:15 | [diff] [blame] | 17 | static UsbChooserContext* GetForProfileIfExists(Profile* profile); |
reillyg | 551eaa4 | 2015-11-11 01:29:21 | [diff] [blame] | 18 | static UsbChooserContextFactory* GetInstance(); |
| 19 | |
Peter Boström | fadb175 | 2021-09-30 19:17:01 | [diff] [blame] | 20 | UsbChooserContextFactory(const UsbChooserContextFactory&) = delete; |
| 21 | UsbChooserContextFactory& operator=(const UsbChooserContextFactory&) = delete; |
| 22 | |
reillyg | 551eaa4 | 2015-11-11 01:29:21 | [diff] [blame] | 23 | private: |
Mikel Astiz | 0eb80d65 | 2023-05-30 19:44:41 | [diff] [blame] | 24 | friend base::NoDestructor<UsbChooserContextFactory>; |
reillyg | 551eaa4 | 2015-11-11 01:29:21 | [diff] [blame] | 25 | |
| 26 | UsbChooserContextFactory(); |
| 27 | ~UsbChooserContextFactory() override; |
| 28 | |
Henrique Nakashima | 9745124 | 2019-04-29 16:14:28 | [diff] [blame] | 29 | // BrowserContextKeyedServiceFactory methods: |
Arthur Milchior | 44fcf99 | 2024-05-10 17:05:58 | [diff] [blame] | 30 | std::unique_ptr<KeyedService> BuildServiceInstanceForBrowserContext( |
reillyg | 551eaa4 | 2015-11-11 01:29:21 | [diff] [blame] | 31 | content::BrowserContext* profile) const override; |
reillyg | 551eaa4 | 2015-11-11 01:29:21 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | #endif // CHROME_BROWSER_USB_USB_CHOOSER_CONTEXT_FACTORY_H_ |