[context-input] Refactor session handle context token generation [chromium/src : main]

0 views
Skip to first unread message

Jason Hu (Gerrit)

unread,
Jan 20, 2026, 12:25:05 PM (14 hours ago) Jan 20
to Sophie Chang, Christian Xu, Shakti Sahu, Tomasz Wiszkowski, Chromium LUCI CQ, AyeAye, marq+...@chromium.org, ios-r...@chromium.org, ios-revie...@chromium.org, stanfie...@google.com, mercer...@google.com, feature-me...@chromium.org, lens-chrome...@google.com
Attention needed from Christian Xu and Sophie Chang

Jason Hu voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Christian Xu
  • Sophie Chang
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9d0b314e91b12e5fdf2c01a91631790baa6c2ce0
Gerrit-Change-Number: 7490382
Gerrit-PatchSet: 6
Gerrit-Owner: Jason Hu <huja...@google.com>
Gerrit-Reviewer: Christian Xu <chris...@chromium.org>
Gerrit-Reviewer: Jason Hu <huja...@google.com>
Gerrit-Reviewer: Sophie Chang <sophi...@chromium.org>
Gerrit-CC: Shakti Sahu <shakt...@chromium.org>
Gerrit-CC: Tomasz Wiszkowski <en...@google.com>
Gerrit-Attention: Sophie Chang <sophi...@chromium.org>
Gerrit-Attention: Christian Xu <chris...@chromium.org>
Gerrit-Comment-Date: Tue, 20 Jan 2026 17:24:56 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Sophie Chang (Gerrit)

unread,
Jan 20, 2026, 2:08:30 PM (12 hours ago) Jan 20
to Jason Hu, Christian Xu, Shakti Sahu, Tomasz Wiszkowski, Chromium LUCI CQ, AyeAye, marq+...@chromium.org, ios-r...@chromium.org, ios-revie...@chromium.org, stanfie...@google.com, mercer...@google.com, feature-me...@chromium.org, lens-chrome...@google.com
Attention needed from Christian Xu and Jason Hu

Sophie Chang voted and added 1 comment

Votes added by Sophie Chang

Code-Review+1

1 comment

File chrome/browser/ui/webui/cr_components/searchbox/contextual_searchbox_handler.cc
Line 422, Patchset 7 (Latest): std::move(callback).Run(context_token);
Sophie Chang . resolved

I am slightly worried about this and what the callback can do with the token - looking at the code for what calls this - its probably fine but can get worse later.

non blocking comment but something to think about for how we can enforce that the callbacks continue to remain safe.

Open in Gerrit

Related details

Attention is currently required from:
  • Christian Xu
  • Jason Hu
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9d0b314e91b12e5fdf2c01a91631790baa6c2ce0
    Gerrit-Change-Number: 7490382
    Gerrit-PatchSet: 7
    Gerrit-Owner: Jason Hu <huja...@google.com>
    Gerrit-Reviewer: Christian Xu <chris...@chromium.org>
    Gerrit-Reviewer: Jason Hu <huja...@google.com>
    Gerrit-Reviewer: Sophie Chang <sophi...@chromium.org>
    Gerrit-CC: Shakti Sahu <shakt...@chromium.org>
    Gerrit-CC: Tomasz Wiszkowski <en...@google.com>
    Gerrit-Attention: Jason Hu <huja...@google.com>
    Gerrit-Attention: Christian Xu <chris...@chromium.org>
    Gerrit-Comment-Date: Tue, 20 Jan 2026 19:08:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jason Hu (Gerrit)

    unread,
    Jan 20, 2026, 4:05:52 PM (10 hours ago) Jan 20
    to Sophie Chang, Christian Xu, Shakti Sahu, Tomasz Wiszkowski, Chromium LUCI CQ, AyeAye, marq+...@chromium.org, ios-r...@chromium.org, ios-revie...@chromium.org, stanfie...@google.com, mercer...@google.com, feature-me...@chromium.org, lens-chrome...@google.com
    Attention needed from Christian Xu

    Jason Hu added 1 comment

    File chrome/browser/ui/webui/cr_components/searchbox/contextual_searchbox_handler.cc
    Line 422, Patchset 7: std::move(callback).Run(context_token);
    Sophie Chang . resolved

    I am slightly worried about this and what the callback can do with the token - looking at the code for what calls this - its probably fine but can get worse later.

    non blocking comment but something to think about for how we can enforce that the callbacks continue to remain safe.

    Jason Hu

    Totally agreed, thanks Sophie! I put a TODO here to make this desire explicit

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Christian Xu
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9d0b314e91b12e5fdf2c01a91631790baa6c2ce0
    Gerrit-Change-Number: 7490382
    Gerrit-PatchSet: 8
    Gerrit-Owner: Jason Hu <huja...@google.com>
    Gerrit-Reviewer: Christian Xu <chris...@chromium.org>
    Gerrit-Reviewer: Jason Hu <huja...@google.com>
    Gerrit-Reviewer: Sophie Chang <sophi...@chromium.org>
    Gerrit-CC: Shakti Sahu <shakt...@chromium.org>
    Gerrit-CC: Tomasz Wiszkowski <en...@google.com>
    Gerrit-Attention: Christian Xu <chris...@chromium.org>
    Gerrit-Comment-Date: Tue, 20 Jan 2026 21:05:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sophie Chang <sophi...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Shakti Sahu (Gerrit)

    unread,
    Jan 20, 2026, 4:51:08 PM (9 hours ago) Jan 20
    to Jason Hu, Sophie Chang, Christian Xu, Tomasz Wiszkowski, Chromium LUCI CQ, AyeAye, marq+...@chromium.org, ios-r...@chromium.org, ios-revie...@chromium.org, stanfie...@google.com, mercer...@google.com, feature-me...@chromium.org, lens-chrome...@google.com
    Attention needed from Christian Xu and Jason Hu

    Shakti Sahu voted and added 4 comments

    Votes added by Shakti Sahu

    Code-Review+1

    4 comments

    Patchset-level comments
    File-level comment, Patchset 8 (Latest):
    Shakti Sahu . resolved

    Thanks. LGTM

    Commit Message
    Line 14, Patchset 8 (Latest):
    Shakti Sahu . unresolved

    nit: Mind saying something like we now synchronously generate the token.

    File chrome/browser/ui/webui/cr_components/searchbox/contextual_searchbox_handler.cc
    Line 422, Patchset 7: std::move(callback).Run(context_token);
    Sophie Chang . resolved

    I am slightly worried about this and what the callback can do with the token - looking at the code for what calls this - its probably fine but can get worse later.

    non blocking comment but something to think about for how we can enforce that the callbacks continue to remain safe.

    Jason Hu

    Totally agreed, thanks Sophie! I put a TODO here to make this desire explicit

    Shakti Sahu

    I was thinking of dropping the callback from mojom but it seems it's used here.
    https://source.chromium.org/chromium/chromium/src/+/main:ui/webui/resources/cr_components/composebox/composebox.ts;drc=d570742b45b6f71bef4dfcce5f8c1710a4d4fdcb;l=678

    But I agree, it looks a bit weird. Wanted to change it to say something like `TokenCallback` but I can't since it's mojom autogenerated code.

    Line 508, Patchset 7: FROM_HERE, base::BindOnce(std::move(callback), true));
    Shakti Sahu . unresolved

    nit: `/*<param_name>=*/`

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Christian Xu
    • Jason Hu
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I9d0b314e91b12e5fdf2c01a91631790baa6c2ce0
      Gerrit-Change-Number: 7490382
      Gerrit-PatchSet: 8
      Gerrit-Owner: Jason Hu <huja...@google.com>
      Gerrit-Reviewer: Christian Xu <chris...@chromium.org>
      Gerrit-Reviewer: Jason Hu <huja...@google.com>
      Gerrit-Reviewer: Shakti Sahu <shakt...@chromium.org>
      Gerrit-Reviewer: Sophie Chang <sophi...@chromium.org>
      Gerrit-CC: Tomasz Wiszkowski <en...@google.com>
      Gerrit-Attention: Jason Hu <huja...@google.com>
      Gerrit-Attention: Christian Xu <chris...@chromium.org>
      Gerrit-Comment-Date: Tue, 20 Jan 2026 21:50:56 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Jason Hu <huja...@google.com>
      Comment-In-Reply-To: Sophie Chang <sophi...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Jason Hu (Gerrit)

      unread,
      Jan 20, 2026, 7:39:32 PM (7 hours ago) Jan 20
      to Shakti Sahu, Sophie Chang, Christian Xu, Tomasz Wiszkowski, Chromium LUCI CQ, AyeAye, marq+...@chromium.org, ios-r...@chromium.org, ios-revie...@chromium.org, stanfie...@google.com, mercer...@google.com, feature-me...@chromium.org, lens-chrome...@google.com
      Attention needed from Christian Xu

      Jason Hu added 3 comments

      Commit Message
      Line 14, Patchset 8:
      Shakti Sahu . resolved

      nit: Mind saying something like we now synchronously generate the token.

      Jason Hu

      Done

      File chrome/browser/ui/webui/cr_components/searchbox/contextual_searchbox_handler.cc
      Line 508, Patchset 7: FROM_HERE, base::BindOnce(std::move(callback), true));
      Shakti Sahu . resolved

      nit: `/*<param_name>=*/`

      Jason Hu

      Done

      Line 508, Patchset 7: FROM_HERE, base::BindOnce(std::move(callback), true));
      Shakti Sahu . resolved

      nit: `/*<param_name>=*/`

      Jason Hu

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Christian Xu
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I9d0b314e91b12e5fdf2c01a91631790baa6c2ce0
        Gerrit-Change-Number: 7490382
        Gerrit-PatchSet: 10
        Gerrit-Owner: Jason Hu <huja...@google.com>
        Gerrit-Reviewer: Christian Xu <chris...@chromium.org>
        Gerrit-Reviewer: Jason Hu <huja...@google.com>
        Gerrit-Reviewer: Shakti Sahu <shakt...@chromium.org>
        Gerrit-Reviewer: Sophie Chang <sophi...@chromium.org>
        Gerrit-CC: Tomasz Wiszkowski <en...@google.com>
        Gerrit-Attention: Christian Xu <chris...@chromium.org>
        Gerrit-Comment-Date: Wed, 21 Jan 2026 00:39:23 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Shakti Sahu <shakt...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages