fix: persist permission granted to serial ports (#30209)

This commit is contained in:
John Kleinschmidt 2021-07-26 13:10:57 -04:00 committed by GitHub
parent d2989de5d9
commit 461db8f1ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 138 additions and 38 deletions

View file

@ -8,6 +8,7 @@
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "base/memory/weak_ptr.h"
#include "chrome/browser/predictors/preconnect_manager.h"
@ -45,6 +46,9 @@ class ResolveProxyHelper;
class WebViewManager;
class ProtocolRegistry;
// Preference keys for device apis
extern const char kSerialGrantedDevicesPref[];
class ElectronBrowserContext : public content::BrowserContext {
public:
// partition_id => browser_context
@ -139,6 +143,19 @@ class ElectronBrowserContext : public content::BrowserContext {
network::mojom::SSLConfigPtr GetSSLConfig();
void SetSSLConfigClient(mojo::Remote<network::mojom::SSLConfigClient> client);
// Grants |origin| access to |object| by writing it into the browser context.
// To be used in place of ObjectPermissionContextBase::GrantObjectPermission.
void GrantObjectPermission(const url::Origin& origin,
base::Value object,
const std::string& pref_key);
// Returns the list of objects that |origin| has been granted permission to
// access. To be used in place of
// ObjectPermissionContextBase::GetGrantedObjects.
std::vector<std::unique_ptr<base::Value>> GetGrantedObjects(
const url::Origin& origin,
const std::string& pref_key);
~ElectronBrowserContext() override;
private: