-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[PSST] Show infobar when the feature availability is detected for the website #34174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vadimstruts
wants to merge
22
commits into
master
Choose a base branch
from
52731-psst-create-consent-ui-elements
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+951
−215
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
dceb914
started to add
vadimstruts 1c9bc26
made dialog to appear + added browser test infrastructure
vadimstruts 5ec8451
work on stability
vadimstruts 4f9e195
finished to fix flow to wait for settings page loaded and then redire…
vadimstruts 9f0e519
optimization + reduces complexity of the OnPolicyScriptResult
vadimstruts b85134f
fix browser test
vadimstruts 3a17e13
fix browser test
vadimstruts bec1e2d
removed logs
vadimstruts 3dbede7
presubmit
vadimstruts 41f8463
fix unit tests
vadimstruts 1b5e0fd
removed unneded code
vadimstruts f9a467b
review
vadimstruts f8bb004
review
vadimstruts 7c183ac
review
vadimstruts 4fd3954
review
vadimstruts febbdf1
review
vadimstruts 6ecddde
review
vadimstruts 1dc8b25
review
vadimstruts d091856
presubmit
vadimstruts f458ade
presubmit
vadimstruts 74dd8b1
splitting the pr: remove dialog part
vadimstruts 9741d66
review
vadimstruts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
90
browser/psst/psst_tab_web_contents_observer_browsertest.cc
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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