#include "content/renderer/accessibility/render_accessibility_impl.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <set>
#include <string>
#include <utility>
#include "base/command_line.h"
#include "base/containers/queue.h"
#include "base/debug/crash_logging.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "content/public/renderer/render_thread.h"
#include "content/renderer/accessibility/annotations/ax_annotators_manager.h"
#include "content/renderer/accessibility/ax_action_target_factory.h"
#include "content/renderer/accessibility/ax_tree_snapshotter_impl.h"
#include "content/renderer/accessibility/blink_ax_action_target.h"
#include "content/renderer/accessibility/render_accessibility_manager.h"
#include "content/renderer/render_frame_impl.h"
#include "services/metrics/public/cpp/mojo_ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/web/web_disallow_transition_scope.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_input_element.h"
#include "third_party/blink/public/web/web_page_popup.h"
#include "third_party/blink/public/web/web_plugin_container.h"
#include "third_party/blink/public/web/web_settings.h"
#include "third_party/blink/public/web/web_view.h"
#include "ui/accessibility/ax_enum_util.h"
#include "ui/accessibility/ax_event_intent.h"
#include "ui/accessibility/ax_mode_histogram_logger.h"
#include "ui/accessibility/ax_node.h"
#include "ui/accessibility/ax_role_properties.h"
#include "ui/accessibility/ax_tree_id.h"
#include "ui/gfx/geometry/vector2d_conversions.h"
WebAXContext;
WebAXObject;
WebDocument;
WebElement;
WebNode;
WebSettings;
WebView;
namespace {
constexpr base::TimeDelta kMinSerializationTimeToSend = …;
constexpr base::TimeDelta kMinUKMDelay = …;
void SetAccessibilityCrashKey(ui::AXMode mode) { … }
}
namespace content {
RenderAccessibilityImpl::RenderAccessibilityImpl(
RenderAccessibilityManager* const render_accessibility_manager,
RenderFrameImpl* const render_frame)
: … { … }
RenderAccessibilityImpl::~RenderAccessibilityImpl() = default;
void RenderAccessibilityImpl::DidCreateNewDocument() { … }
void RenderAccessibilityImpl::DidCommitProvisionalLoad(
ui::PageTransition transition) { … }
void RenderAccessibilityImpl::NotifyAccessibilityModeChange(
const ui::AXMode& mode) { … }
void RenderAccessibilityImpl::set_reset_token(uint32_t reset_token) { … }
#if BUILDFLAG(IS_CHROMEOS)
void RenderAccessibilityImpl::FireLayoutComplete() {
if (ax_context_) {
ax_context_->AddEventToSerializationQueue(
ui::AXEvent(ComputeRoot().AxID(), ax::mojom::Event::kLayoutComplete),
true);
}
}
#endif
void RenderAccessibilityImpl::FireLoadCompleteIfLoaded() { … }
void RenderAccessibilityImpl::HitTest(
const gfx::Point& point,
ax::mojom::Event event_to_fire,
int request_id,
blink::mojom::RenderAccessibility::HitTestCallback callback) { … }
void RenderAccessibilityImpl::PerformAction(const ui::AXActionData& data) { … }
void RenderAccessibilityImpl::Reset(uint32_t reset_token) { … }
void RenderAccessibilityImpl::MarkWebAXObjectDirty(
const WebAXObject& obj,
ax::mojom::EventFrom event_from,
ax::mojom::Action event_from_action,
std::vector<ui::AXEventIntent> event_intents,
ax::mojom::Event event_type) { … }
void RenderAccessibilityImpl::HandleAXEvent(const ui::AXEvent& event) { … }
void RenderAccessibilityImpl::ScheduleImmediateAXUpdate() { … }
bool RenderAccessibilityImpl::HasActiveDocument() const { … }
ui::AXMode RenderAccessibilityImpl::GetAXMode() const { … }
WebDocument RenderAccessibilityImpl::GetMainDocument() const { … }
std::string RenderAccessibilityImpl::GetLanguage() { … }
bool RenderAccessibilityImpl::SendAccessibilitySerialization(
std::vector<ui::AXTreeUpdate> updates,
std::vector<ui::AXEvent> events,
bool had_load_complete_messages) { … }
void RenderAccessibilityImpl::OnSerializationReceived() { … }
void RenderAccessibilityImpl::OnLoadInlineTextBoxes(
const ui::AXActionTarget* target) { … }
void RenderAccessibilityImpl::OnGetImageData(const ui::AXActionTarget* target,
const gfx::Size& max_size) { … }
void RenderAccessibilityImpl::OnDestruct() { … }
blink::WebDocument RenderAccessibilityImpl::GetPopupDocument() { … }
WebAXObject RenderAccessibilityImpl::ComputeRoot() { … }
void RenderAccessibilityImpl::ConnectionClosed() { … }
void RenderAccessibilityImpl::RecordInaccessiblePdfUkm() { … }
void RenderAccessibilityImpl::SetPluginAXTreeActionTargetAdapter(
PluginAXTreeActionTargetAdapter* adapter) { … }
void RenderAccessibilityImpl::MaybeSendUKM() { … }
void RenderAccessibilityImpl::ResetUKMData() { … }
}