Daniel d'Andrada | 6ac3d85 | 2023-03-27 16:05:31 | [diff] [blame] | 1 | // Copyright 2023 The Chromium Authors |
| 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_SMART_CARD_CHROMEOS_SMART_CARD_DELEGATE_H_ |
| 6 | #define CHROME_BROWSER_SMART_CARD_CHROMEOS_SMART_CARD_DELEGATE_H_ |
| 7 | |
Daniel d'Andrada | d6cd88f | 2023-12-12 14:35:51 | [diff] [blame^] | 8 | #include "base/memory/weak_ptr.h" |
| 9 | #include "chrome/browser/smart_card/smart_card_permission_request.h" |
Daniel d'Andrada | 6ac3d85 | 2023-03-27 16:05:31 | [diff] [blame] | 10 | #include "content/public/browser/smart_card_delegate.h" |
| 11 | |
| 12 | class ChromeOsSmartCardDelegate : public content::SmartCardDelegate { |
| 13 | public: |
| 14 | ChromeOsSmartCardDelegate(); |
Daniel d'Andrada | d6cd88f | 2023-12-12 14:35:51 | [diff] [blame^] | 15 | ~ChromeOsSmartCardDelegate() override; |
Daniel d'Andrada | 6ac3d85 | 2023-03-27 16:05:31 | [diff] [blame] | 16 | |
| 17 | // `content::SmartCardDelegate` overrides: |
| 18 | mojo::PendingRemote<device::mojom::SmartCardContextFactory> |
| 19 | GetSmartCardContextFactory(content::BrowserContext& browser_context) override; |
Daniel d'Andrada | 8153e72 | 2023-11-15 10:54:09 | [diff] [blame] | 20 | bool HasReaderPermission(content::RenderFrameHost& render_frame_host, |
| 21 | const std::string& reader_name) override; |
| 22 | void RequestReaderPermission( |
| 23 | content::RenderFrameHost& render_frame_host, |
| 24 | const std::string& reader_name, |
| 25 | RequestReaderPermissionCallback callback) override; |
Daniel d'Andrada | d6cd88f | 2023-12-12 14:35:51 | [diff] [blame^] | 26 | |
| 27 | private: |
| 28 | void OnPermissionRequestDecided(const url::Origin& origin, |
| 29 | const std::string& reader_name, |
| 30 | RequestReaderPermissionCallback callback, |
| 31 | SmartCardPermissionRequest::Result result); |
| 32 | |
| 33 | base::WeakPtrFactory<ChromeOsSmartCardDelegate> weak_factory_{this}; |
Daniel d'Andrada | 6ac3d85 | 2023-03-27 16:05:31 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | #endif // CHROME_BROWSER_SMART_CARD_CHROMEOS_SMART_CARD_DELEGATE_H_ |