blob: 5bb1a38a5607b47dbca7a27756259dfcca053330 [file] [log] [blame]
Daniel d'Andrada6ac3d852023-03-27 16:05:311// 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'Andradad6cd88f2023-12-12 14:35:518#include "base/memory/weak_ptr.h"
9#include "chrome/browser/smart_card/smart_card_permission_request.h"
Daniel d'Andrada6ac3d852023-03-27 16:05:3110#include "content/public/browser/smart_card_delegate.h"
11
12class ChromeOsSmartCardDelegate : public content::SmartCardDelegate {
13 public:
14 ChromeOsSmartCardDelegate();
Daniel d'Andradad6cd88f2023-12-12 14:35:5115 ~ChromeOsSmartCardDelegate() override;
Daniel d'Andrada6ac3d852023-03-27 16:05:3116
17 // `content::SmartCardDelegate` overrides:
18 mojo::PendingRemote<device::mojom::SmartCardContextFactory>
19 GetSmartCardContextFactory(content::BrowserContext& browser_context) override;
Daniel d'Andrada8153e722023-11-15 10:54:0920 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'Andradad6cd88f2023-12-12 14:35:5126
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'Andrada6ac3d852023-03-27 16:05:3134};
35
36#endif // CHROME_BROWSER_SMART_CARD_CHROMEOS_SMART_CARD_DELEGATE_H_