Skip to content

Commit 3392308

Browse files
ryansturmChromium LUCI CQ
authored andcommitted
[AiData] Populate inner_text and inner_text_offset in page_context
This duplicates inner text fields in an effort to transition to PageContext only. Bug: 372032599 Change-Id: Id00a4a7ab7e5457c8271a0c7419e9e1b2f95db1f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5926238 Reviewed-by: Ryan Sturm <ryansturm@chromium.org> Commit-Queue: Ryan Sturm <ryansturm@google.com> Reviewed-by: Nick Birnie <birnie@google.com> Cr-Commit-Position: refs/heads/main@{#1367809}
1 parent 1bea9d9 commit 3392308

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

chrome/browser/ai/ai_data_keyed_service.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ void OnGetInnerTextForModelPrototyping(
4646
optimization_guide::proto::
4747
ModelPrototypingRequest_BrowserCollectedInformation>();
4848
data->set_inner_text(result->inner_text);
49+
data->mutable_page_context()->set_inner_text(result->inner_text);
4950
if (result->node_offset) {
5051
data->set_inner_text_offset(result->node_offset.value());
52+
data->mutable_page_context()->set_inner_text_offset(
53+
result->node_offset.value());
5154
}
5255
}
5356
std::move(continue_callback).Run(std::move(data));

chrome/browser/ai/ai_data_keyed_service_browsertest.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ IN_PROC_BROWSER_TEST_F(AiDataKeyedServiceBrowserTest, InnerText) {
8888
LoadSimplePageAndData();
8989
ASSERT_TRUE(ai_data());
9090
EXPECT_EQ(ai_data()->inner_text(), "Non empty simple page");
91+
EXPECT_EQ(ai_data()->page_context().inner_text(), "Non empty simple page");
9192
}
9293

9394
IN_PROC_BROWSER_TEST_F(AiDataKeyedServiceBrowserTest, InnerTextOffset) {
9495
LoadSimplePageAndData();
9596
ASSERT_TRUE(ai_data());
9697
EXPECT_EQ(ai_data()->inner_text_offset(), 0u);
98+
EXPECT_EQ(ai_data()->page_context().inner_text_offset(), 0u);
9799
}
98100

99101
IN_PROC_BROWSER_TEST_F(AiDataKeyedServiceBrowserTest, Title) {

0 commit comments

Comments
 (0)