chromium/chrome/browser/extensions/forced_extensions/install_stage_tracker.cc

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

#include "chrome/browser/extensions/forced_extensions/install_stage_tracker.h"

#include "base/check_op.h"
#include "base/observer_list.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/forced_extensions/install_stage_tracker_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "extensions/browser/install/sandboxed_unpacker_failure_reason.h"
#include "net/base/net_errors.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "components/user_manager/user.h"          // nogncheck
#include "components/user_manager/user_manager.h"  // nogncheck
#include "components/user_manager/user_type.h"     // nogncheck
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

namespace extensions {

namespace {
// Returns true if the `current_stage` should be overridden by the
// `new_stage`.
bool ShouldOverrideCurrentStage(
    std::optional<InstallStageTracker::Stage> current_stage,
    InstallStageTracker::Stage new_stage) {}

}  // namespace

#if BUILDFLAG(IS_CHROMEOS_ASH)
InstallStageTracker::UserInfo::UserInfo() = default;
InstallStageTracker::UserInfo::UserInfo(const UserInfo&) = default;
InstallStageTracker::UserInfo::UserInfo(user_manager::UserType user_type,
                                        bool is_new_user,
                                        bool is_user_present)
    : user_type(user_type),
      is_new_user(is_new_user),
      is_user_present(is_user_present) {}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

// InstallStageTracker::InstallationData implementation.

InstallStageTracker::InstallationData::InstallationData() = default;
InstallStageTracker::InstallationData::~InstallationData() = default;

InstallStageTracker::InstallationData::InstallationData(
    const InstallationData&) = default;

std::string InstallStageTracker::GetFormattedInstallationData(
    const InstallationData& data) {}

// InstallStageTracker::Observer implementation.

InstallStageTracker::Observer::~Observer() = default;

// InstallStageTracker implementation.

InstallStageTracker::InstallStageTracker(const content::BrowserContext* context)
    :{}

InstallStageTracker::~InstallStageTracker() = default;

// static
InstallStageTracker* InstallStageTracker::Get(
    content::BrowserContext* context) {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
InstallStageTracker::UserInfo InstallStageTracker::GetUserInfo(
    Profile* profile) {
  const user_manager::User* user =
      ash::ProfileHelper::Get()->GetUserByProfile(profile);
  if (!user)
    return UserInfo();

  bool is_new_user = user_manager::UserManager::Get()->IsCurrentUserNew() ||
                     profile->IsNewProfile();
  UserInfo current_user(user->GetType(), is_new_user, /*is_user_present=*/true);
  return current_user;
}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

void InstallStageTracker::ReportInfoOnNoUpdatesFailure(
    const ExtensionId& id,
    const std::string& info) {}

void InstallStageTracker::ReportManifestInvalidFailure(
    const ExtensionId& id,
    const ExtensionDownloaderDelegate::FailureData& failure_data) {}

void InstallStageTracker::ReportInstallCreationStage(
    const ExtensionId& id,
    InstallCreationStage stage) {}

void InstallStageTracker::ReportInstallationStage(const ExtensionId& id,
                                                  Stage stage) {}

void InstallStageTracker::ReportDownloadingStage(
    const ExtensionId& id,
    ExtensionDownloaderDelegate::Stage stage) {}

void InstallStageTracker::ReportCRXInstallationStage(const ExtensionId& id,
                                                     InstallationStage stage) {}

void InstallStageTracker::ReportDownloadingCacheStatus(
    const ExtensionId& id,
    ExtensionDownloaderDelegate::CacheStatus cache_status) {}

InstallStageTracker::AppStatusError
InstallStageTracker::GetManifestInvalidAppStatusError(
    const std::string& status) {}

void InstallStageTracker::ReportFetchErrorCodes(
    const ExtensionId& id,
    const ExtensionDownloaderDelegate::FailureData& failure_data) {}

void InstallStageTracker::ReportFetchError(
    const ExtensionId& id,
    FailureReason reason,
    const ExtensionDownloaderDelegate::FailureData& failure_data) {}

void InstallStageTracker::ReportFailure(const ExtensionId& id,
                                        FailureReason reason) {}

void InstallStageTracker::ReportExtensionType(const ExtensionId& id,
                                              Manifest::Type extension_type) {}

void InstallStageTracker::ReportCrxInstallError(
    const ExtensionId& id,
    FailureReason reason,
    CrxInstallErrorDetail crx_install_error) {}

void InstallStageTracker::ReportSandboxedUnpackerFailureReason(
    const ExtensionId& id,
    const CrxInstallError& crx_install_error) {}

InstallStageTracker::InstallationData InstallStageTracker::Get(
    const ExtensionId& id) {}

void InstallStageTracker::Clear() {}

void InstallStageTracker::AddObserver(Observer* observer) {}

void InstallStageTracker::RemoveObserver(Observer* observer) {}

void InstallStageTracker::NotifyObserversOfFailure(
    const ExtensionId& id,
    FailureReason reason,
    const InstallationData& data) {}

}  //  namespace extensions