chromium/extensions/browser/api/feedback_private/feedback_private_api.cc

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

#include "extensions/browser/api/feedback_private/feedback_private_api.h"

#include <string>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/functional/bind.h"
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_base.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/statistics_recorder.h"
#include "base/metrics/user_metrics.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/feedback/content/content_tracing_manager.h"
#include "components/feedback/feedback_common.h"
#include "components/feedback/feedback_constants.h"
#include "components/feedback/feedback_report.h"
#include "components/feedback/system_logs/system_logs_fetcher.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/api/feedback_private/feedback_private_delegate.h"
#include "extensions/browser/api/feedback_private/feedback_service.h"
#include "extensions/browser/event_router.h"
#include "extensions/common/api/feedback_private.h"
#include "extensions/common/constants.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "net/base/network_change_notifier.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "extensions/browser/api/feedback_private/log_source_access_manager.h"
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

LogsMapEntry;
FeedbackData;

namespace extensions {

feedback_private;

FeedbackFlow;
FeedbackInfo;
LogsMapEntry;
LogSource;

LogsMap;

static base::LazyInstance<BrowserContextKeyedAPIFactory<FeedbackPrivateAPI>>::
    DestructorAtExit g_factory =;

namespace {

constexpr int kChromeLabsAndKaleidoscopeProductId =;

// Getting the filename of a blob prepends a "C:\fakepath" to the filename.
// This is undesirable, strip it if it exists.
std::string StripFakepath(const std::string& path) {}

// Returns the type of the landing page which is shown to the user when the
// report is successfully sent.
feedback_private::LandingPageType GetLandingPageType(
    const feedback::FeedbackData& feedback_data) {}

bool IsGoogleInternalAccountEmail(content::BrowserContext* context) {}

void SendFeedback(content::BrowserContext* browser_context,
                  const FeedbackInfo& feedback_info,
                  const bool load_system_info,
                  base::OnceCallback<void(feedback_private::LandingPageType,
                                          bool)> callback) {}

feedback_private::Status ToFeedbackStatus(bool success) {}

}  // namespace

// static
BrowserContextKeyedAPIFactory<FeedbackPrivateAPI>*
FeedbackPrivateAPI::GetFactoryInstance() {}

FeedbackPrivateAPI::FeedbackPrivateAPI(content::BrowserContext* context)
    :{}

FeedbackPrivateAPI::~FeedbackPrivateAPI() = default;

scoped_refptr<FeedbackService> FeedbackPrivateAPI::GetService() const {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
LogSourceAccessManager* FeedbackPrivateAPI::GetLogSourceAccessManager() const {
  return log_source_access_manager_.get();
}
#endif

std::unique_ptr<FeedbackInfo> FeedbackPrivateAPI::CreateFeedbackInfo(
    const std::string& description_template,
    const std::string& description_placeholder_text,
    const std::string& category_tag,
    const std::string& extra_diagnostics,
    const GURL& page_url,
    api::feedback_private::FeedbackFlow flow,
    bool from_assistant,
    bool include_bluetooth_logs,
    bool show_questionnaire,
    bool from_chrome_labs_or_kaleidoscope,
    bool from_autofill,
    const base::Value::Dict& autofill_metadata,
    const base::Value::Dict& ai_metadata) {}

ExtensionFunction::ResponseAction FeedbackPrivateGetUserEmailFunction::Run() {}

ExtensionFunction::ResponseAction
FeedbackPrivateGetSystemInformationFunction::Run() {}

void FeedbackPrivateGetSystemInformationFunction::OnCompleted(
    std::unique_ptr<system_logs::SystemLogsResponse> sys_info) {}

ExtensionFunction::ResponseAction FeedbackPrivateReadLogSourceFunction::Run() {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
void FeedbackPrivateReadLogSourceFunction::OnCompleted(
    std::unique_ptr<feedback_private::ReadLogSourceResult> result) {
  Respond(
      ArgumentList(feedback_private::ReadLogSource::Results::Create(*result)));
}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

ExtensionFunction::ResponseAction FeedbackPrivateSendFeedbackFunction::Run() {}

void FeedbackPrivateSendFeedbackFunction::OnCompleted(
    api::feedback_private::LandingPageType type,
    bool success) {}

ExtensionFunction::ResponseAction FeedbackPrivateOpenFeedbackFunction::Run() {}

}  // namespace extensions