2015-07-16 23:40:01 +02:00
|
|
|
// Copyright 2015 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions 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.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_CLIENT_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_CLIENT_H_
|
|
|
|
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "extensions/browser/extensions_browser_client.h"
|
|
|
|
|
|
|
|
namespace extensions {
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
class ExtensionHostQueue;
|
2015-07-16 23:40:01 +02:00
|
|
|
class ExtensionsAPIClient;
|
|
|
|
|
|
|
|
// An ExtensionsBrowserClient that supports a single content::BrowserContent
|
|
|
|
// with no related incognito context.
|
|
|
|
class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
|
|
|
public:
|
|
|
|
CefExtensionsBrowserClient();
|
|
|
|
~CefExtensionsBrowserClient() override;
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
// Returns the singleton CefExtensionsBrowserClient instance.
|
|
|
|
static CefExtensionsBrowserClient* Get();
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
// ExtensionsBrowserClient overrides:
|
|
|
|
bool IsShuttingDown() override;
|
|
|
|
bool AreExtensionsDisabled(const base::CommandLine& command_line,
|
|
|
|
content::BrowserContext* context) override;
|
|
|
|
bool IsValidContext(content::BrowserContext* context) override;
|
|
|
|
bool IsSameContext(content::BrowserContext* first,
|
|
|
|
content::BrowserContext* second) override;
|
|
|
|
bool HasOffTheRecordContext(content::BrowserContext* context) override;
|
|
|
|
content::BrowserContext* GetOffTheRecordContext(
|
|
|
|
content::BrowserContext* context) override;
|
|
|
|
content::BrowserContext* GetOriginalContext(
|
|
|
|
content::BrowserContext* context) override;
|
|
|
|
bool IsGuestSession(content::BrowserContext* context) const override;
|
|
|
|
bool IsExtensionIncognitoEnabled(
|
|
|
|
const std::string& extension_id,
|
|
|
|
content::BrowserContext* context) const override;
|
|
|
|
bool CanExtensionCrossIncognito(
|
|
|
|
const Extension* extension,
|
|
|
|
content::BrowserContext* context) const override;
|
|
|
|
net::URLRequestJob* MaybeCreateResourceBundleRequestJob(
|
|
|
|
net::URLRequest* request,
|
|
|
|
net::NetworkDelegate* network_delegate,
|
|
|
|
const base::FilePath& directory_path,
|
|
|
|
const std::string& content_security_policy,
|
|
|
|
bool send_cors_header) override;
|
2018-03-20 21:15:08 +01:00
|
|
|
base::FilePath GetBundleResourcePath(
|
|
|
|
const network::ResourceRequest& request,
|
|
|
|
const base::FilePath& extension_resources_path,
|
2019-07-16 19:59:21 +02:00
|
|
|
int* resource_id) const override;
|
2018-03-20 21:15:08 +01:00
|
|
|
void LoadResourceFromResourceBundle(
|
|
|
|
const network::ResourceRequest& request,
|
|
|
|
network::mojom::URLLoaderRequest loader,
|
|
|
|
const base::FilePath& resource_relative_path,
|
2019-07-16 19:59:21 +02:00
|
|
|
const int resource_id,
|
2018-03-20 21:15:08 +01:00
|
|
|
const std::string& content_security_policy,
|
|
|
|
network::mojom::URLLoaderClientPtr client,
|
|
|
|
bool send_cors_header) override;
|
2017-12-07 22:44:24 +01:00
|
|
|
bool AllowCrossRendererResourceLoad(const GURL& url,
|
|
|
|
content::ResourceType resource_type,
|
|
|
|
ui::PageTransition page_transition,
|
|
|
|
int child_id,
|
2015-07-16 23:40:01 +02:00
|
|
|
bool is_incognito,
|
|
|
|
const Extension* extension,
|
2017-12-07 22:44:24 +01:00
|
|
|
const ExtensionSet& extensions,
|
|
|
|
const ProcessMap& process_map) override;
|
2015-07-16 23:40:01 +02:00
|
|
|
PrefService* GetPrefServiceForContext(
|
|
|
|
content::BrowserContext* context) override;
|
|
|
|
void GetEarlyExtensionPrefsObservers(
|
|
|
|
content::BrowserContext* context,
|
2019-07-16 19:59:21 +02:00
|
|
|
std::vector<EarlyExtensionPrefsObserver*>* observers) const override;
|
2015-07-16 23:40:01 +02:00
|
|
|
ProcessManagerDelegate* GetProcessManagerDelegate() const override;
|
2017-05-17 11:29:28 +02:00
|
|
|
std::unique_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
|
2017-08-04 00:55:19 +02:00
|
|
|
bool CreateBackgroundExtensionHost(const Extension* extension,
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
const GURL& url,
|
|
|
|
ExtensionHost** host) override;
|
2015-07-16 23:40:01 +02:00
|
|
|
bool DidVersionUpdate(content::BrowserContext* context) override;
|
|
|
|
void PermitExternalProtocolHandler() override;
|
2018-07-24 00:32:02 +02:00
|
|
|
bool IsInDemoMode() override;
|
2018-10-02 14:14:11 +02:00
|
|
|
bool IsScreensaverInDemoMode(const std::string& app_id) override;
|
2015-07-16 23:40:01 +02:00
|
|
|
bool IsRunningInForcedAppMode() override;
|
2018-03-20 21:15:08 +01:00
|
|
|
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
|
2015-10-09 17:23:12 +02:00
|
|
|
bool IsLoggedInAsPublicAccount() override;
|
2015-07-16 23:40:01 +02:00
|
|
|
ExtensionSystemProvider* GetExtensionSystemFactory() override;
|
2017-09-06 23:40:58 +02:00
|
|
|
void RegisterExtensionInterfaces(service_manager::BinderRegistryWithArgs<
|
|
|
|
content::RenderFrameHost*>* registry,
|
|
|
|
content::RenderFrameHost* render_frame_host,
|
|
|
|
const Extension* extension) const override;
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
|
2015-07-16 23:40:01 +02:00
|
|
|
content::BrowserContext* context) const override;
|
|
|
|
const ComponentExtensionResourceManager*
|
|
|
|
GetComponentExtensionResourceManager() override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void BroadcastEventToRenderers(
|
|
|
|
events::HistogramValue histogram_value,
|
|
|
|
const std::string& event_name,
|
|
|
|
std::unique_ptr<base::ListValue> args) override;
|
2015-07-16 23:40:01 +02:00
|
|
|
ExtensionCache* GetExtensionCache() override;
|
|
|
|
bool IsBackgroundUpdateAllowed() override;
|
|
|
|
bool IsMinBrowserVersionSupported(const std::string& min_version) override;
|
2015-07-24 02:06:56 +02:00
|
|
|
ExtensionWebContentsObserver* GetExtensionWebContentsObserver(
|
|
|
|
content::WebContents* web_contents) override;
|
2016-10-21 21:52:29 +02:00
|
|
|
KioskDelegate* GetKioskDelegate() override;
|
2017-07-27 01:19:27 +02:00
|
|
|
bool IsLockScreenContext(content::BrowserContext* context) override;
|
2017-09-06 23:40:58 +02:00
|
|
|
std::string GetApplicationLocale() override;
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
ExtensionHostQueue* GetExtensionHostQueue();
|
2015-07-16 23:40:01 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Support for extension APIs.
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<ExtensionsAPIClient> api_client_;
|
2015-07-16 23:40:01 +02:00
|
|
|
|
|
|
|
// Resource manager used to supply resources from pak files.
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<ComponentExtensionResourceManager> resource_manager_;
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
// Used to create deferred RenderViews for extensions.
|
|
|
|
std::unique_ptr<ExtensionHostQueue> extension_host_queue_;
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefExtensionsBrowserClient);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace extensions
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_CLIENT_H_
|