Tested manually. Haven't updated tests but need a review first.
void ContextualTasksComposeboxHandler::UpdateSuggestedTabContext(FYI. This was moved from `ComposeboxHandler` to this subclass. The logic seems more convenient here. `ContextualTasksComposeboxHandler` will do the dismissed URL tracking and filtering of suggested URLs (which is the active tab URL) when requested by outside world.
!web_ui_interface->IsActiveTabContextSuggestionShowing()) {This makes the earlier check for `auto_tab_context_suggestion_enabled` earlier redundant.
void ContextualTasksUI::DisableActiveTabContextSuggestion() {This is now directly done at `ContextualTasksComposeboxHandler`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// TODO(shaktisahu): Pass the URL of the chip from the UI. This requires URLThis one is a bit weird. When I tried to plumb the URL through JS, a whole lot of plumbing across various callsites was needed and was making things messier there. That's why I decided to take this alternative. Is this correct enough?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
blocklisted_suggestions_.erase(tab->GetContents()->GetLastCommittedURL());this can be moved to outside the if block
if (from_automatic_chip) {should this matter? if user delete another URL context, we should also stop suggesting it right?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
blocklisted_suggestions_.erase(tab->GetContents()->GetLastCommittedURL());this can be moved to outside the if block
Removed the `blocklisted_suggestions_.erase` from the other block around line 814. We want to remove it from blocklist only if it was explicitly added and not auto-added.
if (from_automatic_chip) {should this matter? if user delete another URL context, we should also stop suggesting it right?
Yes, but there is a caveat below. I am assuming that the current URL in active tab is the one that the user has dismissed via auto chip. I couldn't get it plumbed all the way through.
So, I am just adding to blocklist when auto chip is dismissed.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (from_automatic_chip) {Shakti Sahushould this matter? if user delete another URL context, we should also stop suggesting it right?
Yes, but there is a caveat below. I am assuming that the current URL in active tab is the one that the user has dismissed via auto chip. I couldn't get it plumbed all the way through.
So, I am just adding to blocklist when auto chip is dismissed.
so if you check the current code, I guess you can get the URL from the file info even it it is not auto chip?
std::optional<SessionID> associated_tab_id;
auto* contextual_session_handle = GetContextualSessionHandle();
if (contextual_session_handle) {
const contextual_search::FileInfo* file_info =
contextual_session_handle->GetController()->GetFileInfo(file_token);
if (file_info && file_info->tab_session_id.has_value()) {
associated_tab_id = file_info->tab_session_id.value();
}
}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (from_automatic_chip) {Shakti Sahushould this matter? if user delete another URL context, we should also stop suggesting it right?
Min QinYes, but there is a caveat below. I am assuming that the current URL in active tab is the one that the user has dismissed via auto chip. I couldn't get it plumbed all the way through.
So, I am just adding to blocklist when auto chip is dismissed.
so if you check the current code, I guess you can get the URL from the file info even it it is not auto chip?
std::optional<SessionID> associated_tab_id;
auto* contextual_session_handle = GetContextualSessionHandle();
if (contextual_session_handle) {
const contextual_search::FileInfo* file_info =
contextual_session_handle->GetController()->GetFileInfo(file_token);
if (file_info && file_info->tab_session_id.has_value()) {
associated_tab_id = file_info->tab_session_id.value();
}
}
I also thought so, but I think the auto chip aren't even added to the `contextual_session_handle` because they have `delay_upload=true`. So there wont be a `file_info` I think.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (from_automatic_chip) {Shakti Sahushould this matter? if user delete another URL context, we should also stop suggesting it right?
Min QinYes, but there is a caveat below. I am assuming that the current URL in active tab is the one that the user has dismissed via auto chip. I couldn't get it plumbed all the way through.
So, I am just adding to blocklist when auto chip is dismissed.
Shakti Sahuso if you check the current code, I guess you can get the URL from the file info even it it is not auto chip?
std::optional<SessionID> associated_tab_id;
auto* contextual_session_handle = GetContextualSessionHandle();
if (contextual_session_handle) {
const contextual_search::FileInfo* file_info =
contextual_session_handle->GetController()->GetFileInfo(file_token);
if (file_info && file_info->tab_session_id.has_value()) {
associated_tab_id = file_info->tab_session_id.value();
}
}
I also thought so, but I think the auto chip aren't even added to the `contextual_session_handle` because they have `delay_upload=true`. So there wont be a `file_info` I think.
Yes, for autochip, we can just use active tab to get the URL, but for non-auto chip, we get it from file_info and also add it to blacklist here?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (from_automatic_chip) {Shakti Sahushould this matter? if user delete another URL context, we should also stop suggesting it right?
Min QinYes, but there is a caveat below. I am assuming that the current URL in active tab is the one that the user has dismissed via auto chip. I couldn't get it plumbed all the way through.
So, I am just adding to blocklist when auto chip is dismissed.
Shakti Sahuso if you check the current code, I guess you can get the URL from the file info even it it is not auto chip?
std::optional<SessionID> associated_tab_id;
auto* contextual_session_handle = GetContextualSessionHandle();
if (contextual_session_handle) {
const contextual_search::FileInfo* file_info =
contextual_session_handle->GetController()->GetFileInfo(file_token);
if (file_info && file_info->tab_session_id.has_value()) {
associated_tab_id = file_info->tab_session_id.value();
}
}
Min QinI also thought so, but I think the auto chip aren't even added to the `contextual_session_handle` because they have `delay_upload=true`. So there wont be a `file_info` I think.
Yes, for autochip, we can just use active tab to get the URL, but for non-auto chip, we get it from file_info and also add it to blacklist here?
But the URL may have changed in that tab though (since it was an explictly added tab). Is that still okay?
For the auto-chip case, it's very unlikely to have changed since it constantly observes navigations on the active tab.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (from_automatic_chip) {Shakti Sahushould this matter? if user delete another URL context, we should also stop suggesting it right?
Min QinYes, but there is a caveat below. I am assuming that the current URL in active tab is the one that the user has dismissed via auto chip. I couldn't get it plumbed all the way through.
So, I am just adding to blocklist when auto chip is dismissed.
Shakti Sahuso if you check the current code, I guess you can get the URL from the file info even it it is not auto chip?
std::optional<SessionID> associated_tab_id;
auto* contextual_session_handle = GetContextualSessionHandle();
if (contextual_session_handle) {
const contextual_search::FileInfo* file_info =
contextual_session_handle->GetController()->GetFileInfo(file_token);
if (file_info && file_info->tab_session_id.has_value()) {
associated_tab_id = file_info->tab_session_id.value();
}
}
Min QinI also thought so, but I think the auto chip aren't even added to the `contextual_session_handle` because they have `delay_upload=true`. So there wont be a `file_info` I think.
Shakti SahuYes, for autochip, we can just use active tab to get the URL, but for non-auto chip, we get it from file_info and also add it to blacklist here?
But the URL may have changed in that tab though (since it was an explictly added tab). Is that still okay?
For the auto-chip case, it's very unlikely to have changed since it constantly observes navigations on the active tab.
the fileinfo.tab_url should contain the tab URL uploaded? https://source.chromium.org/chromium/chromium/src/+/main:components/contextual_search/contextual_search_types.h;l=101
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
blocklisted_suggestions_.erase(tab->GetContents()->GetLastCommittedURL());Shakti Sahuthis can be moved to outside the if block
Removed the `blocklisted_suggestions_.erase` from the other block around line 814. We want to remove it from blocklist only if it was explicitly added and not auto-added.
Done
if (from_automatic_chip) {Shakti Sahushould this matter? if user delete another URL context, we should also stop suggesting it right?
Min QinYes, but there is a caveat below. I am assuming that the current URL in active tab is the one that the user has dismissed via auto chip. I couldn't get it plumbed all the way through.
So, I am just adding to blocklist when auto chip is dismissed.
Shakti Sahuso if you check the current code, I guess you can get the URL from the file info even it it is not auto chip?
std::optional<SessionID> associated_tab_id;
auto* contextual_session_handle = GetContextualSessionHandle();
if (contextual_session_handle) {
const contextual_search::FileInfo* file_info =
contextual_session_handle->GetController()->GetFileInfo(file_token);
if (file_info && file_info->tab_session_id.has_value()) {
associated_tab_id = file_info->tab_session_id.value();
}
}
Min QinI also thought so, but I think the auto chip aren't even added to the `contextual_session_handle` because they have `delay_upload=true`. So there wont be a `file_info` I think.
Shakti SahuYes, for autochip, we can just use active tab to get the URL, but for non-auto chip, we get it from file_info and also add it to blacklist here?
Min QinBut the URL may have changed in that tab though (since it was an explictly added tab). Is that still okay?
For the auto-chip case, it's very unlikely to have changed since it constantly observes navigations on the active tab.
Shakti Sahuthe fileinfo.tab_url should contain the tab URL uploaded? https://source.chromium.org/chromium/chromium/src/+/main:components/contextual_search/contextual_search_types.h;l=101
Oh, I see. Thanks for catching this. Updated the CL.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
sophiechang@ - For overall lgtm on chrome/browser/ui/webui/cr_components/composebox/composebox_handler.*
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |