chromium/content/browser/sms/webotp_service.cc

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

#include "content/browser/sms/webotp_service.h"

#include <iterator>
#include <memory>
#include <optional>
#include <queue>
#include <string>
#include <utility>

#include "base/check_op.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/sms/sms_metrics.h"
#include "content/browser/sms/user_consent_handler.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/sms_fetcher.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/common/sms/webotp_constants.h"
#include "third_party/blink/public/mojom/sms/webotp_service.mojom-shared.h"

SmsStatus;
Outcome;

namespace content {

namespace {

// Only |kMaxUniqueOriginInAncestorChainForWebOTP| unique origins in the chain
// is considered valid. In addition, the unique origins must be consecutive.
// e.g. the following are valid:
// A.com (calls WebOTP API)
// A.com -> A.com (calls WebOTP API)
// A.com -> A.com -> B.com (calls WebOTP API)
// A.com -> B.com -> B.com (calls WebOTP API)
// while the following are invalid:
// A.com -> B.com -> A.com (calls WebOTP API)
// A.com -> B.com -> C.com (calls WebOTP API)
bool ValidateAndCollectUniqueOrigins(RenderFrameHost& rfh,
                                     OriginList& origin_list) {}

bool IsCrossOriginFrame(RenderFrameHost& rfh) {}

Outcome FailureTypeToOutcome(SmsFetchFailureType failure_type) {}

Outcome SmsStatusToOutcome(SmsStatus status) {}

ukm::SourceId GetPageUkmSourceId(RenderFrameHost& render_frame_host) {}

}  // namespace

WebOTPService::WebOTPService(
    SmsFetcher* fetcher,
    const OriginList& origin_list,
    RenderFrameHost& host,
    mojo::PendingReceiver<blink::mojom::WebOTPService> receiver)
    :{}

WebOTPService::~WebOTPService() {}

// static
bool WebOTPService::Create(
    SmsFetcher* fetcher,
    RenderFrameHost* host,
    mojo::PendingReceiver<blink::mojom::WebOTPService> receiver) {}

// static
WebOTPService& WebOTPService::CreateForTesting(
    SmsFetcher* fetcher,
    const OriginList& origins,
    RenderFrameHost& frame_host,
    mojo::PendingReceiver<blink::mojom::WebOTPService> receiver) {}

void WebOTPService::WillBeDestroyed(DocumentServiceDestructionReason) {}

void WebOTPService::Receive(ReceiveCallback callback) {}

void WebOTPService::OnReceive(const OriginList& origin_list,
                              const std::string& one_time_code,
                              UserConsent consent_requirement) {}

void WebOTPService::OnFailure(FailureType failure_type) {}

void WebOTPService::Abort() {}

void WebOTPService::CompleteRequest(blink::mojom::SmsStatus status) {}

void WebOTPService::CleanUp() {}

UserConsentHandler* WebOTPService::CreateConsentHandler(
    UserConsent consent_requirement) {}

UserConsentHandler* WebOTPService::GetConsentHandler() {}

void WebOTPService::SetConsentHandlerForTesting(UserConsentHandler* handler) {}

void WebOTPService::OnTimeout() {}

void WebOTPService::RecordMetrics(blink::mojom::SmsStatus status) {}

void WebOTPService::OnUserConsentComplete(UserConsentResult result) {}

}  // namespace content