8383c14aba
* chore: bump chromium in DEPS to 91c9f44297abe2844f593ec7956e6ce79c81f463 * chore: update chromium patches * chore: update v8 patches * build: service_names.mojom has been deleted Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2568681 * chore: add DISPLAY_CAPTURE permission to converter Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2551098 * chore: handle AXPropertyFilter::SCRIPT in accessibility_ui Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2563923 * refactor: web_isolated_world_ids.h has been deleted Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2585255 * refactor: ResourceType has been deprecated / removed in ExtensionsBrowserClient Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2562002 * chore: fix lint * chore: remove deleted headers * build: disable gn check for blink header * fix: refactor X11 event handling Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2577887 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2585750 * chore: update patches * chore: bump chromium in DEPS to bfd8e7dbd37af8b1bc40d887815edd5a29496fa3 * chore: update patches * refactor: xeventobserver is now x11:eventobserver Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2585750 * refactor: remove UseWebUIBindingsForURL Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2583590 * chore: DidProcessXEvent has been removed * chore: bump chromium in DEPS to b13e791d7244a08d9d61dbfa2bb2b6cdf1ff6294 * chore: update patches * build: change gfx::GetAtom to x11:GetAtom Refs:d972a0ae4a
* build: change gfx namespace to x11 Ref:d972a0ae4a
* build: change ui namespace to x11 Refs:c38f8571a8
:ui/gfx/x/xproto_util.h;dlc=ba9145d0c7f2b10e869e2ba482ca05b75ca35812 * chore: add patch to fix blink prefs fetching during frame swap * chore: fix lint * fix: do not make invalid SKImageRep in FrameSubscriber Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2572896 Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
147 lines
6 KiB
C++
147 lines
6 KiB
C++
// 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 SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSIONS_BROWSER_CLIENT_H_
|
|
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSIONS_BROWSER_CLIENT_H_
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "base/compiler_specific.h"
|
|
#include "base/macros.h"
|
|
#include "build/build_config.h"
|
|
#include "extensions/browser/extensions_browser_client.h"
|
|
#include "extensions/browser/kiosk/kiosk_delegate.h"
|
|
#include "mojo/public/cpp/bindings/pending_remote.h"
|
|
#include "services/network/public/mojom/fetch_api.mojom.h"
|
|
|
|
class PrefService;
|
|
|
|
namespace extensions {
|
|
class ExtensionsAPIClient;
|
|
class KioskDelegate;
|
|
class ProcessManagerDelegate;
|
|
class ElectronProcessManagerDelegate;
|
|
class ProcessMap;
|
|
class ElectronComponentExtensionResourceManager;
|
|
} // namespace extensions
|
|
|
|
namespace electron {
|
|
|
|
// An ExtensionsBrowserClient that supports a single content::BrowserContext
|
|
// with no related incognito context.
|
|
class ElectronExtensionsBrowserClient
|
|
: public extensions::ExtensionsBrowserClient {
|
|
public:
|
|
ElectronExtensionsBrowserClient();
|
|
~ElectronExtensionsBrowserClient() override;
|
|
|
|
// 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 extensions::Extension* extension,
|
|
content::BrowserContext* context) const override;
|
|
base::FilePath GetBundleResourcePath(
|
|
const network::ResourceRequest& request,
|
|
const base::FilePath& extension_resources_path,
|
|
int* resource_id) const override;
|
|
void LoadResourceFromResourceBundle(
|
|
const network::ResourceRequest& request,
|
|
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
|
const base::FilePath& resource_relative_path,
|
|
int resource_id,
|
|
const std::string& content_security_policy,
|
|
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
|
bool send_cors_header) override;
|
|
bool AllowCrossRendererResourceLoad(
|
|
const network::ResourceRequest& request,
|
|
network::mojom::RequestDestination destination,
|
|
ui::PageTransition page_transition,
|
|
int child_id,
|
|
bool is_incognito,
|
|
const extensions::Extension* extension,
|
|
const extensions::ExtensionSet& extensions,
|
|
const extensions::ProcessMap& process_map) override;
|
|
PrefService* GetPrefServiceForContext(
|
|
content::BrowserContext* context) override;
|
|
void GetEarlyExtensionPrefsObservers(
|
|
content::BrowserContext* context,
|
|
std::vector<extensions::EarlyExtensionPrefsObserver*>* observers)
|
|
const override;
|
|
extensions::ProcessManagerDelegate* GetProcessManagerDelegate()
|
|
const override;
|
|
std::unique_ptr<extensions::ExtensionHostDelegate>
|
|
CreateExtensionHostDelegate() override;
|
|
bool DidVersionUpdate(content::BrowserContext* context) override;
|
|
void PermitExternalProtocolHandler() override;
|
|
bool IsInDemoMode() override;
|
|
bool IsScreensaverInDemoMode(const std::string& app_id) override;
|
|
bool IsRunningInForcedAppMode() override;
|
|
bool IsAppModeForcedForApp(
|
|
const extensions::ExtensionId& extension_id) override;
|
|
bool IsLoggedInAsPublicAccount() override;
|
|
extensions::ExtensionSystemProvider* GetExtensionSystemFactory() override;
|
|
std::unique_ptr<extensions::RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
|
|
content::BrowserContext* context) const override;
|
|
const extensions::ComponentExtensionResourceManager*
|
|
GetComponentExtensionResourceManager() override;
|
|
void BroadcastEventToRenderers(
|
|
extensions::events::HistogramValue histogram_value,
|
|
const std::string& event_name,
|
|
std::unique_ptr<base::ListValue> args,
|
|
bool dispatch_to_off_the_record_profiles) override;
|
|
extensions::ExtensionCache* GetExtensionCache() override;
|
|
bool IsBackgroundUpdateAllowed() override;
|
|
bool IsMinBrowserVersionSupported(const std::string& min_version) override;
|
|
extensions::ExtensionWebContentsObserver* GetExtensionWebContentsObserver(
|
|
content::WebContents* web_contents) override;
|
|
extensions::KioskDelegate* GetKioskDelegate() override;
|
|
bool IsLockScreenContext(content::BrowserContext* context) override;
|
|
std::string GetApplicationLocale() override;
|
|
std::string GetUserAgent() const override;
|
|
void RegisterBrowserInterfaceBindersForFrame(
|
|
mojo::BinderMapWithContext<content::RenderFrameHost*>* map,
|
|
content::RenderFrameHost* render_frame_host,
|
|
const extensions::Extension* extension) const override;
|
|
|
|
// Sets the API client.
|
|
void SetAPIClientForTest(extensions::ExtensionsAPIClient* api_client);
|
|
|
|
private:
|
|
// Support for extension APIs.
|
|
std::unique_ptr<extensions::ExtensionsAPIClient> api_client_;
|
|
|
|
// Support for ProcessManager.
|
|
std::unique_ptr<extensions::ElectronProcessManagerDelegate>
|
|
process_manager_delegate_;
|
|
|
|
// The extension cache used for download and installation.
|
|
std::unique_ptr<extensions::ExtensionCache> extension_cache_;
|
|
|
|
std::unique_ptr<extensions::KioskDelegate> kiosk_delegate_;
|
|
|
|
std::unique_ptr<extensions::ElectronComponentExtensionResourceManager>
|
|
resource_manager_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionsBrowserClient);
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSIONS_BROWSER_CLIENT_H_
|