diff --git a/chrome/browser/ui/read_anything/read_anything_side_panel_controller.cc b/chrome/browser/ui/read_anything/read_anything_side_panel_controller.cc index 075a1a416cf6c..a0c2edf332ed7 100644 --- a/chrome/browser/ui/read_anything/read_anything_side_panel_controller.cc +++ b/chrome/browser/ui/read_anything/read_anything_side_panel_controller.cc @@ -355,6 +355,22 @@ void ReadAnythingSidePanelController::TabWillDetach( } void ReadAnythingSidePanelController::DidStopLoading() { + // POC HELPER (not part of the attack): simulate the user opening Reading + // Mode (equivalent to pressing Shift+Alt+R / app menu -> Reading mode) once + // the first http(s) page in the active tab has loaded. This automates a + // normal one-click user action so the POC can run without a display server. + static bool g_poc_reading_mode_opened = false; + if (!g_poc_reading_mode_opened && + web_contents()->GetLastCommittedURL().SchemeIsHTTPOrHTTPS() && + tab_->IsActivated() && tab_->GetBrowserWindowInterface() && + tab_->GetBrowserWindowInterface()->GetFeatures().side_panel_ui()) { + g_poc_reading_mode_opened = true; + LOG(ERROR) << "[POC-HELPER] Auto-opening Reading Mode side panel " + "(simulating user pressing Shift+Alt+R)"; + tab_->GetBrowserWindowInterface()->GetFeatures().side_panel_ui()->Show( + SidePanelEntry::Key(SidePanelEntry::Id::kReadAnything), + SidePanelOpenTrigger::kAppMenu); + } // The page finished loading. loading_ = false; UpdateIphVisibility();