chromium/chrome/renderer/accessibility/read_anything_app_model.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/renderer/accessibility/read_anything_app_model.h"

#include <cstddef>
#include <regex>
#include <string>

#include "base/check.h"
#include "base/containers/contains.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/stringprintf.h"
#include "chrome/renderer/accessibility/read_aloud_traversal_utils.h"
#include "chrome/renderer/accessibility/read_anything_node_utils.h"
#include "content/public/renderer/render_thread.h"
#include "services/strings/grit/services_strings.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/ax_enum_util.h"
#include "ui/accessibility/ax_enums.mojom-shared.h"
#include "ui/accessibility/ax_node.h"
#include "ui/accessibility/ax_node_id_forward.h"
#include "ui/accessibility/ax_role_properties.h"
#include "ui/accessibility/ax_serializable_tree.h"
#include "ui/accessibility/ax_text_utils.h"
#include "ui/accessibility/ax_tree_update_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"

namespace {

base::TimeDelta kTimeElapsedSincePageLoadForDataCollectionSeconds =;
base::TimeDelta kTimeElapsedSinceTreeChangedForDataCollectionSeconds =;

bool GetIsGoogleDocs(const GURL& url) {}

}  // namespace

ReadAnythingAppModel::ReadAnythingAppModel() {}

ReadAnythingAppModel::~ReadAnythingAppModel() = default;

ReadAnythingAppModel::AXTreeInfo::AXTreeInfo(
    std::unique_ptr<ui::AXTreeManager> other) {}

ReadAnythingAppModel::AXTreeInfo::~AXTreeInfo() = default;

void ReadAnythingAppModel::OnSettingsRestoredFromPrefs(
    read_anything::mojom::LineSpacing line_spacing,
    read_anything::mojom::LetterSpacing letter_spacing,
    const std::string& font,
    double font_size,
    bool links_enabled,
    bool images_enabled,
    read_anything::mojom::Colors color) {}

void ReadAnythingAppModel::InsertDisplayNode(const ui::AXNodeID& node) {}

void ReadAnythingAppModel::InsertSelectionNode(const ui::AXNodeID& node) {}

void ReadAnythingAppModel::Reset(
    const std::vector<ui::AXNodeID>& content_node_ids) {}

void ReadAnythingAppModel::ResetSelection() {}

bool ReadAnythingAppModel::PostProcessSelection() {}

void ReadAnythingAppModel::UpdateSelection() {}

void ReadAnythingAppModel::ComputeSelectionNodeIds() {}

bool ReadAnythingAppModel::ContentNodesOnlyContainHeadings() {}

void ReadAnythingAppModel::ComputeDisplayNodeIdsForDistilledTree() {}

bool ReadAnythingAppModel::IsCurrentSelectionEmpty() {}

bool ReadAnythingAppModel::SelectionInsideDisplayNodes() {}

ui::AXSerializableTree* ReadAnythingAppModel::GetTreeFromId(
    const ui::AXTreeID& tree_id) const {}

bool ReadAnythingAppModel::ContainsTree(const ui::AXTreeID& tree_id) const {}

void ReadAnythingAppModel::AddTree(
    const ui::AXTreeID& tree_id,
    std::unique_ptr<ui::AXSerializableTree> tree) {}

void ReadAnythingAppModel::EraseTree(const ui::AXTreeID& tree_id) {}

void ReadAnythingAppModel::AddUrlInformationForTreeId(
    const ui::AXTreeID& tree_id) {}

bool ReadAnythingAppModel::IsDocs() const {}

void ReadAnythingAppModel::AddPendingUpdates(
    const ui::AXTreeID& tree_id,
    std::vector<ui::AXTreeUpdate>& updates) {}

void ReadAnythingAppModel::ClearPendingUpdates() {}

void ReadAnythingAppModel::UnserializePendingUpdates(
    const ui::AXTreeID& tree_id) {}

void ReadAnythingAppModel::UnserializeUpdates(
    std::vector<ui::AXTreeUpdate>& updates,
    const ui::AXTreeID& tree_id) {}

void ReadAnythingAppModel::AccessibilityEventReceived(
    const ui::AXTreeID& tree_id,
    std::vector<ui::AXTreeUpdate>& updates,
    std::vector<ui::AXEvent>& events,
    const bool speech_playing) {}

void ReadAnythingAppModel::OnAXTreeDestroyed(const ui::AXTreeID& tree_id) {}

const ukm::SourceId& ReadAnythingAppModel::UkmSourceId() {}

void ReadAnythingAppModel::SetUkmSourceId(const ukm::SourceId ukm_source_id) {}

int32_t ReadAnythingAppModel::NumSelections() {}

void ReadAnythingAppModel::SetNumSelections(const int32_t& num_selections) {}

ui::AXNode* ReadAnythingAppModel::GetAXNode(
    const ui::AXNodeID& ax_node_id) const {}

bool ReadAnythingAppModel::NodeIsContentNode(
    const ui::AXNodeID& ax_node_id) const {}

double ReadAnythingAppModel::GetLetterSpacingValue(
    read_anything::mojom::LetterSpacing letter_spacing) const {}

double ReadAnythingAppModel::GetLineSpacingValue(
    read_anything::mojom::LineSpacing line_spacing) const {}

std::map<ui::AXTreeID, std::vector<ui::AXTreeUpdate>>&
ReadAnythingAppModel::GetPendingUpdatesForTesting() {}

std::map<ui::AXTreeID, std::unique_ptr<ReadAnythingAppModel::AXTreeInfo>>*
ReadAnythingAppModel::GetTreesForTesting() {}

void ReadAnythingAppModel::EraseTreeForTesting(const ui::AXTreeID& tree_id) {}

void ReadAnythingAppModel::OnScroll(bool on_selection,
                                    bool from_reading_mode) const {}

void ReadAnythingAppModel::OnSelection(ax::mojom::EventFrom event_from) {}

void ReadAnythingAppModel::SetActiveTreeId(const ui::AXTreeID& active_tree_id) {}

void ReadAnythingAppModel::ProcessNonGeneratedEvents(
    const std::vector<ui::AXEvent>& events) {}

void ReadAnythingAppModel::ProcessGeneratedEvents(
    const ui::AXEventGenerator& event_generator,
    size_t prev_tree_size,
    size_t tree_size) {}

bool ReadAnythingAppModel::ScreenAIServiceReadyForDataColletion() const {}

void ReadAnythingAppModel::SetScreenAIServiceReadyForDataColletion(bool value) {}

bool ReadAnythingAppModel::PageFinishedLoadingForDataCollection() const {}

void ReadAnythingAppModel::SetPageFinishedLoadingForDataCollection(bool value) {}

void ReadAnythingAppModel::SetDataCollectionForScreen2xCallback(
    base::RepeatingCallback<void()> callback) {}

void ReadAnythingAppModel::MaybeRunDataCollectionForScreen2xCallback() {}

void ReadAnythingAppModel::IncreaseTextSize() {}

void ReadAnythingAppModel::DecreaseTextSize() {}

void ReadAnythingAppModel::ResetTextSize() {}

void ReadAnythingAppModel::ToggleLinksEnabled() {}

void ReadAnythingAppModel::ToggleImagesEnabled() {}

void ReadAnythingAppModel::SetBaseLanguageCode(const std::string code) {}

std::vector<std::string> ReadAnythingAppModel::GetSupportedFonts() {}