-
Notifications
You must be signed in to change notification settings - Fork 925
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
Adds preferences and methods to delete Leo conversations on Android #27074
Conversation
@diracdeltas let me know do you want me to open an issue for a sec review. I didn't do it as it's basically a fix related to the original sec review for that feature. |
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.
java patching lgtm
if (!service) { | ||
return; | ||
} | ||
service->DeleteConversations(); |
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.
I wonder if we just pass the AIChatService
mojo to the UI instead of passing it via the AIChatSettingsHelper
mojo?
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.
I don't think we ever passed native services to java via mojo. Why do we need that?
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.
we are passing AIChatSettingsHelper to Java and its calling a function which then calls the service function only. So why not just pass the Service to Java now that we have one? AIChatSettingsHelper was made before AIChatService and now that it exists maybe we shouldn't add new things to AIChatSettingsHelper
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.
as per discussion in DM we decided to leave as is as there are questions about the service lifetime, there has to be a native object that hold a pointer for Java.
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.
lgtm
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.
LGTM
Shivan is out, but the original privacy requirement from https://github.com/brave/reviews/issues/1768#issuecomment-2536586219 said Is that the case with this PR? If so there should be a test plan that clearing browser history also clears leo or at least any leo conversations with page context. cc @bridiver if this is your understanding since you were involved in the above privacy review. This is also stated in @petemill 's comment here btw https://github.com/brave/reviews/issues/1703#issuecomment-2523752623. The items below should be implemented on Android before this feature is enabled.
|
I think Android uses the same browser data deletion handling as desktop @diracdeltas |
@diracdeltas correct it is the case with this PR. I just added STR3 with that case in the test plan. |
@@ -22,17 +23,30 @@ | |||
import org.chromium.ui.text.SpanApplier.SpanInfo; | |||
|
|||
public class BraveClearBrowsingDataFragmentAdvanced extends ClearBrowsingDataFragmentAdvanced { | |||
ClearBrowsingDataCheckBoxPreference mClearBrowsingDataCheckBoxPreference; |
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.
Should this be named to mention that it's the checkbox for AIChat? e.g. mClearAIChatDataCheckBoxPreference
?
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.
good point, renaming it
@Override | ||
protected void onClearBrowsingData() { | ||
super.onClearBrowsingData(); | ||
if (mClearBrowsingDataCheckBoxPreference != null | ||
&& mClearBrowsingDataCheckBoxPreference.isChecked()) { | ||
Profile profile = getProfile(); | ||
if (profile == null) { | ||
return; | ||
} | ||
BraveLeoMojomHelper.getInstance(profile).deleteConversations(); | ||
} | ||
} |
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.
Do we need this? Hopefully it gets handled by the shared browser code: https://github.com/brave/brave-core/blob/master/browser/browsing_data/brave_browsing_data_remover_delegate.cc#L55-L79
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.
In Desktop's settings WebUI we add a new checkbox with a browser.clear_data.brave_leo
key (should have been ai_chat
!). The desktop WebUI (and assume somewhere in android preferences) we call browsing_data::GetDataTypeFromDeletionPreference
which we override to provide BrowsingDataType::BRAVE_AI_CHAT
when the browser.clear_data.brave_leo
key is provided. And the rest is handled by the delegate.
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.
we basically discussed that in DM it gets triggered on Android, but for Android case we would need to make a lot of patches inside java files by adding extra type inside ClearBrowsingDataFragment.DialogOption and surrounding
functions. I added a comment inside browser/browsing_data/brave_browsing_data_remover_delegate.cc
where Android implementation is.
3df3911
to
10b350a
Compare
10b350a
to
4d05ccd
Compare
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.
string reviewers ++
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.
LGTM
Released in v1.75.117 |
Issues:
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
STR 1:
Settings->Leo->Delete all Leo AI conversation data
and click confirm.STR 2:
Settings->Brave Shields & privacy->Delete browsing data
and go toAdvanced
tab there.Leo AI
and clickDelete data
and confirm it.STR 3(make sure that deleting browsing history deletes any related web page visit from conversations):
Settings->Brave Shields & privacy->Delete browsing data
and go toBasic
tab there. Make sureBrowsing history
is checked there