2019-07-24 23:01:08 +00:00
|
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_CLIENT_H_
|
|
|
|
#define ELECTRON_SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_CLIENT_H_
|
2019-07-24 23:01:08 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "extensions/common/extensions_client.h"
|
|
|
|
#include "url/gurl.h"
|
|
|
|
|
|
|
|
namespace extensions {
|
|
|
|
class APIPermissionSet;
|
|
|
|
class Extension;
|
|
|
|
class PermissionMessageProvider;
|
|
|
|
class PermissionIDSet;
|
|
|
|
class URLPatternSet;
|
|
|
|
} // namespace extensions
|
|
|
|
|
|
|
|
namespace electron {
|
|
|
|
|
|
|
|
// The app_shell implementation of ExtensionsClient.
|
2020-02-03 22:01:10 +00:00
|
|
|
class ElectronExtensionsClient : public extensions::ExtensionsClient {
|
2019-07-24 23:01:08 +00:00
|
|
|
public:
|
2020-07-14 01:13:34 +00:00
|
|
|
using ScriptingAllowlist = extensions::ExtensionsClient::ScriptingAllowlist;
|
2019-07-24 23:01:08 +00:00
|
|
|
|
2020-02-03 22:01:10 +00:00
|
|
|
ElectronExtensionsClient();
|
|
|
|
~ElectronExtensionsClient() override;
|
2019-07-24 23:01:08 +00:00
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
ElectronExtensionsClient(const ElectronExtensionsClient&) = delete;
|
|
|
|
ElectronExtensionsClient& operator=(const ElectronExtensionsClient&) = delete;
|
|
|
|
|
2019-07-24 23:01:08 +00:00
|
|
|
// ExtensionsClient overrides:
|
|
|
|
void Initialize() override;
|
|
|
|
void InitializeWebStoreUrls(base::CommandLine* command_line) override;
|
|
|
|
const extensions::PermissionMessageProvider& GetPermissionMessageProvider()
|
|
|
|
const override;
|
|
|
|
const std::string GetProductName() override;
|
|
|
|
void FilterHostPermissions(
|
|
|
|
const extensions::URLPatternSet& hosts,
|
|
|
|
extensions::URLPatternSet* new_hosts,
|
|
|
|
extensions::PermissionIDSet* permissions) const override;
|
2020-07-14 01:13:34 +00:00
|
|
|
void SetScriptingAllowlist(const ScriptingAllowlist& allowlist) override;
|
|
|
|
const ScriptingAllowlist& GetScriptingAllowlist() const override;
|
2019-07-24 23:01:08 +00:00
|
|
|
extensions::URLPatternSet GetPermittedChromeSchemeHosts(
|
|
|
|
const extensions::Extension* extension,
|
|
|
|
const extensions::APIPermissionSet& api_permissions) const override;
|
|
|
|
bool IsScriptableURL(const GURL& url, std::string* error) const override;
|
|
|
|
const GURL& GetWebstoreBaseURL() const override;
|
|
|
|
const GURL& GetWebstoreUpdateURL() const override;
|
2022-02-10 02:58:52 +00:00
|
|
|
bool IsBlocklistUpdateURL(const GURL& url) const override;
|
2022-09-07 07:46:37 +00:00
|
|
|
const GURL& GetNewWebstoreBaseURL() const override;
|
2019-07-24 23:01:08 +00:00
|
|
|
|
|
|
|
private:
|
2020-07-14 01:13:34 +00:00
|
|
|
ScriptingAllowlist scripting_allowlist_;
|
2019-07-24 23:01:08 +00:00
|
|
|
|
|
|
|
const GURL webstore_base_url_;
|
2022-09-07 07:46:37 +00:00
|
|
|
const GURL new_webstore_base_url_;
|
2019-07-24 23:01:08 +00:00
|
|
|
const GURL webstore_update_url_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace electron
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_CLIENT_H_
|