Files
brave-core/renderer/brave_render_thread_observer.cc
T
cdesouza-chromium 821274796b [IWYU] Fixing logging inclusions pt.11 (#29531)
This change is one of many fixing inclusion for the following files:

    - `base/notimplemented.h`
    - `base/notreached.h`
    - `base/check.h`
    - `base/dcheck_is_on.h`
    - `base/check_deref.h`
    - `base/check_op.h`
    - `base/logging/log_severity.h`
    - `base/logging.h`

This change is a mechanical change done with the following script:
https://github.com/brave/brave-browser/issues/46707#issuecomment-2960116515

Resolves https://github.com/brave/brave-browser/issues/46707
2025-06-12 13:48:07 +01:00

65 lines
2.1 KiB
C++

/* Copyright (c) 2021 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "brave/renderer/brave_render_thread_observer.h"
#include <utility>
#include "base/no_destructor.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
namespace {
brave::mojom::DynamicParams* GetDynamicConfigParams() {
static base::NoDestructor<brave::mojom::DynamicParams> dynamic_params;
return dynamic_params.get();
}
} // namespace
BraveRenderThreadObserver::BraveRenderThreadObserver() = default;
BraveRenderThreadObserver::~BraveRenderThreadObserver() = default;
// static
const brave::mojom::DynamicParams&
BraveRenderThreadObserver::GetDynamicParams() {
return *GetDynamicConfigParams();
}
void BraveRenderThreadObserver::RegisterMojoInterfaces(
blink::AssociatedInterfaceRegistry* associated_interfaces) {
associated_interfaces->AddInterface<brave::mojom::BraveRendererConfiguration>(
base::BindRepeating(
&BraveRenderThreadObserver::OnRendererConfigurationAssociatedRequest,
base::Unretained(this)));
}
void BraveRenderThreadObserver::UnregisterMojoInterfaces(
blink::AssociatedInterfaceRegistry* associated_interfaces) {
associated_interfaces->RemoveInterface(
brave::mojom::BraveRendererConfiguration::Name_);
}
void BraveRenderThreadObserver::OnRendererConfigurationAssociatedRequest(
mojo::PendingAssociatedReceiver<brave::mojom::BraveRendererConfiguration>
receiver) {
renderer_configuration_receivers_.Add(this, std::move(receiver));
}
void BraveRenderThreadObserver::SetInitialConfiguration(bool is_tor_process) {
is_tor_process_ = is_tor_process;
}
void BraveRenderThreadObserver::SetConfiguration(
brave::mojom::DynamicParamsPtr params) {
*GetDynamicConfigParams() = std::move(*params);
}
bool BraveRenderThreadObserver::IsOnionAllowed() const {
return is_tor_process_ ||
!GetDynamicConfigParams()->onion_only_in_tor_windows;
}