Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion android/android_browser_tests.gni
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ android_test_exception_deps = [
"//brave/browser/farbling:browser_tests",
"//brave/browser/net:browser_tests",
"//brave/browser/permissions:browser_tests",
"//brave/browser/psst:browser_tests",
"//brave/browser/test:browser_tests",
"//brave/browser/ui:browser_tests",
"//brave/browser/ui/tabs/test:browser_tests",
Expand Down
8 changes: 8 additions & 0 deletions app/brave_generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,14 @@ Or change later at <ph name="SETTINGS_EXTENIONS_LINK">$2<ex>brave://settings/ext
Enable
</message>

<!--PSST -->
<message name="IDS_BRAVE_PSST_INFOBAR_MESSAGE" desc="The text label of PSST availability announcement.">
Brave can help you optimize this site's privacy settings. Would you like to review our suggestions?
</message>
<message name="IDS_BRAVE_PSST_INFO_BAR_REVIEW_SUGGESTIONS" desc="OK button that shows on the info bar and allows to start review of the PSST suggestions">
Review suggestions
</message>
Comment on lines +1438 to +1444
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment with screenshots of the strings for i18n


<!-- Brave policy -->
<message name="IDS_BRAVE_CONTROLLED_SETTING_POLICY" desc="Text displayed in the controlled settings bubble when a setting's value is managed by policy.">
This setting is managed by your administrator or by another Brave policy.
Expand Down
1 change: 1 addition & 0 deletions brave_paks.gni
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import("//brave/components/ai_chat/core/common/buildflags/buildflags.gni")
import("//brave/components/brave_rewards/core/buildflags/buildflags.gni")
import("//brave/components/psst/buildflags/buildflags.gni")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't seem used

import("//brave/components/tor/buildflags/buildflags.gni")
import("//build/config/locales.gni")
import("//chrome/common/features.gni")
Expand Down
37 changes: 9 additions & 28 deletions browser/psst/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ static_library("psst") {
public = [
"psst_settings_service_factory.h",
"psst_ui_delegate_impl.h",
"psst_ui_presenter.h",
]

sources = [
"psst_infobar_delegate.cc",
"psst_infobar_delegate.h",
"psst_settings_service_factory.cc",
"psst_ui_delegate_impl.cc",
"psst_ui_presenter.cc",
]

deps = [
Expand All @@ -22,9 +26,14 @@ static_library("psst") {
"//brave/components/psst/browser/core",
"//brave/components/psst/common",
"//chrome/browser/content_settings:content_settings_factory",
"//chrome/browser/infobars",
"//chrome/browser/profiles",
"//chrome/browser/ui/webui",
"//components/content_settings/core/browser",
"//components/infobars/content",
"//components/infobars/core",
"//components/permissions",
"//ui/web_dialogs",
]
}

Expand All @@ -46,31 +55,3 @@ source_set("unit_tests") {
"//url",
]
}

source_set("browser_tests") {
testonly = true
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

sources = [ "psst_tab_web_contents_observer_browsertest.cc" ]

deps = [
"//base",
"//brave/components/brave_shields/content/browser",
"//brave/components/cosmetic_filters/browser",
"//brave/components/psst/browser/content",
"//brave/components/psst/browser/core",
"//brave/components/psst/buildflags",
"//brave/components/psst/common",
"//chrome/test:test_support",
"//components/component_updater:test_support",
"//content/test:test_support",
"//net:test_support",
"//url",
]

if (is_android) {
deps += [ "//chrome/test:test_support_ui_android" ]
} else {
deps += [ "//chrome/test:test_support_ui" ]
}
}
64 changes: 64 additions & 0 deletions browser/psst/psst_infobar_delegate.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) 2026 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 https://mozilla.org/MPL/2.0/.

#include "brave/browser/psst/psst_infobar_delegate.h"

#include <memory>

#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "brave/grit/brave_generated_resources.h"
#include "chrome/browser/infobars/confirm_infobar_creator.h"
#include "components/infobars/core/infobar.h"
#include "ui/base/l10n/l10n_util.h"

namespace psst {
// static
void PsstInfoBarDelegate::Create(infobars::InfoBarManager* infobar_manager,
AcceptCallback on_accept_callback) {
infobar_manager->AddInfoBar(
CreateConfirmInfoBar(base::WrapUnique<PsstInfoBarDelegate>(
new PsstInfoBarDelegate(std::move(on_accept_callback)))));
}

PsstInfoBarDelegate::PsstInfoBarDelegate(AcceptCallback on_accept_callback)
: on_accept_callback_(std::move(on_accept_callback)) {}

PsstInfoBarDelegate::~PsstInfoBarDelegate() = default;

infobars::InfoBarDelegate::InfoBarIdentifier
PsstInfoBarDelegate::GetIdentifier() const {
return BRAVE_PSST_INFOBAR_DELEGATE;
}

std::u16string PsstInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_BRAVE_PSST_INFOBAR_MESSAGE);
}

int PsstInfoBarDelegate::GetButtons() const {
return BUTTON_OK;
}

std::u16string PsstInfoBarDelegate::GetButtonLabel(InfoBarButton button) const {
return l10n_util::GetStringUTF16(IDS_BRAVE_PSST_INFO_BAR_REVIEW_SUGGESTIONS);
}

bool PsstInfoBarDelegate::Accept() {
if (on_accept_callback_) {
std::move(on_accept_callback_).Run(true);
}

return true;
}

bool PsstInfoBarDelegate::Cancel() {
if (on_accept_callback_) {
std::move(on_accept_callback_).Run(false);
}

return true;
}

} // namespace psst
43 changes: 43 additions & 0 deletions browser/psst/psst_infobar_delegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) 2026 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 https://mozilla.org/MPL/2.0/.

#ifndef BRAVE_BROWSER_PSST_PSST_INFOBAR_DELEGATE_H_
#define BRAVE_BROWSER_PSST_PSST_INFOBAR_DELEGATE_H_

#include "base/functional/callback.h"
#include "base/functional/callback_forward.h"
#include "components/infobars/core/confirm_infobar_delegate.h"

namespace psst {

class PsstInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
using AcceptCallback = base::OnceCallback<void(const bool is_accepted)>;
static void Create(infobars::InfoBarManager* infobar_manager,
AcceptCallback on_accept_callback);

PsstInfoBarDelegate(const PsstInfoBarDelegate&) = delete;
PsstInfoBarDelegate& operator=(const PsstInfoBarDelegate&) = delete;

~PsstInfoBarDelegate() override;

bool Accept() override;
bool Cancel() override;

private:
explicit PsstInfoBarDelegate(AcceptCallback on_accept_callback);

// BraveConfirmInfoBarDelegate overrides:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
std::u16string GetMessageText() const override;
int GetButtons() const override;
std::u16string GetButtonLabel(InfoBarButton button) const override;

AcceptCallback on_accept_callback_;
};

} // namespace psst

#endif // BRAVE_BROWSER_PSST_PSST_INFOBAR_DELEGATE_H_
90 changes: 0 additions & 90 deletions browser/psst/psst_tab_web_contents_observer_browsertest.cc

This file was deleted.

Loading
Loading