chromium/chrome/browser/chrome_browser_main_linux.cc

// Copyright 2012 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/chrome_browser_main_linux.h"

#include <memory>
#include <string>
#include <utility>

#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_features.h"
#include "chrome/grit/branded_strings.h"
#include "components/password_manager/core/browser/password_manager_switches.h"
#include "content/public/browser/browser_thread.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "device/bluetooth/dbus/bluez_dbus_thread_manager.h"
#include "ui/base/l10n/l10n_util.h"

#if BUILDFLAG(IS_LINUX)
#include "ui/ozone/public/ozone_platform.h"
#endif

#if BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/chromeos/tast_support/stack_sampling_recorder.h"
#include "chrome/installer/util/google_update_settings.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/lacros/dbus/lacros_dbus_thread_manager.h"
#endif

#if defined(USE_DBUS) && !BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/dbus_memory_pressure_evaluator_linux.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#include "ash/public/cpp/new_window_delegate.h"
#include "ash/webui/sanitize_ui/url_constants.h"
#include "ash/webui/system_apps/public/system_web_app_type.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h"
#include "chrome/browser/ui/webui/ash/settings/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#endif

#if !BUILDFLAG(IS_CHROMEOS_ASH)
#include "base/linux_util.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "components/os_crypt/sync/key_storage_config_linux.h"
#include "components/os_crypt/sync/os_crypt.h"
#endif

ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux(
    bool is_integration_test,
    StartupData* startup_data)
    :{}

ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() {}

void ChromeBrowserMainPartsLinux::PostCreateMainMessageLoop() {}

#if BUILDFLAG(IS_LINUX)
void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() {}
#endif

void ChromeBrowserMainPartsLinux::PreProfileInit() {}

#if (defined(USE_DBUS) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_CHROMEOS_ASH)
void ChromeBrowserMainPartsLinux::PostBrowserStart() {}
#endif  // (defined(USE_DBUS) && !BUILDFLAG(IS_CHROMEOS)) ||
        // BUILDFLAG(IS_CHROMEOS_ASH)

#if BUILDFLAG(IS_CHROMEOS_ASH)
void ChromeBrowserMainPartsLinux::CheckIfSanitizeCompleted() {
  PrefService* prefs = ProfileManager::GetPrimaryUserProfile()->GetPrefs();
  if (base::FeatureList::IsEnabled(ash::features::kSanitize) &&
      prefs->GetBoolean(ash::settings::prefs::kSanitizeCompleted)) {
    prefs->SetBoolean(ash::settings::prefs::kSanitizeCompleted, false);
    prefs->CommitPendingWrite();
    ash::SystemAppLaunchParams params;
    params.launch_source = apps::LaunchSource::kUnknown;
    ash::LaunchSystemWebAppAsync(ProfileManager::GetPrimaryUserProfile(),
                                 ash::SystemWebAppType::OS_SANITIZE, params);
  }
}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

void ChromeBrowserMainPartsLinux::PostDestroyThreads() {}