electron/shell/browser/extensions/electron_extensions_browser_client.h
electron-roller[bot] 81c143318b
chore: bump chromium to 94.0.4590.2 (main) (#30274)
* chore: bump chromium in DEPS to 94.0.4587.0

* chore: update patches

* 2823155: fix GPU video decoding capabilities enumeration

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/2823155

* 3041383: Reduce includes in url_request_mojom_traits.h

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3041383

* chore: bump chromium in DEPS to 94.0.4588.0

* chore: update patches

* chore: bump chromium in DEPS to 94.0.4589.0

* chore: update patches

* 3050633: Rename ScaleFactor to ResourceScaleFactor

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3050633

* 3048296: Create new mojo target to prevent traits header spreading

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3048296

* 3046186: Rename base::ClampToRange

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3046186

* chore: update picture-in-picture patch

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056037

* chore: bump chromium in DEPS to 94.0.4590.0

* chore: update patches

* 3057495: Fix base::NoDestructor usage in Mac KeychainPassword

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3057495

* 3056134: Remove NetworkIsolationKey unused methods

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056134

* 3035091: [rab/gsab] Fix gsab maxByteLength after transferring to worker

Adds a patch to v8 to disable a DCHECK that is also firing on node streams
in child processes.

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3035091

* chore: bump chromium in DEPS to 94.0.4590.2

* chore: fix mas_no_private_api.patch

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049052

* 3049555: [views] Add CHECK to prevent fallthrough to global NativeTheme

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049555

* chore: empty commit

* chore: fix whitespace for lint

* chore: cherry-pick chromium woa fix

* Revert "chore: cherry-pick chromium woa fix"

This reverts commit 64f3082e2d5f93ef0e2ac5d98246532a105fd4a1.

* chore: fix the build on Windows on ARM

* chore: remove commented code in printing.patch

* fixup! chore: remove commented code in printing.patch

do not remove the new weak_ptr check

* build: sync disable_use_lld_for_macos.patch

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-08-11 17:04:56 -04:00

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/cpp/resource_request.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,
scoped_refptr<net::HttpResponseHeaders> headers,
mojo::PendingRemote<network::mojom::URLLoaderClient> client) 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_