Update background_mode_manager.cc

This commit is contained in:
Alexander David Frick 2023-01-25 01:40:08 -06:00 committed by GitHub
parent 640e2444c6
commit 75a531292b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,6 @@
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "base/one_shot_event.h" #include "base/one_shot_event.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h" #include "build/chromeos_buildflags.h"
@ -372,11 +371,6 @@ BackgroundModeManager::~BackgroundModeManager() {
// static // static
void BackgroundModeManager::RegisterPrefs(PrefRegistrySimple* registry) { void BackgroundModeManager::RegisterPrefs(PrefRegistrySimple* registry) {
#if BUILDFLAG(IS_MAC)
registry->RegisterBooleanPref(prefs::kUserRemovedLoginItem, false);
registry->RegisterBooleanPref(prefs::kChromeCreatedLoginItem, false);
registry->RegisterBooleanPref(prefs::kMigratedLoginItemPref, false);
#endif
registry->RegisterBooleanPref(prefs::kBackgroundModeEnabled, false); registry->RegisterBooleanPref(prefs::kBackgroundModeEnabled, false);
} }
@ -439,9 +433,11 @@ void BackgroundModeManager::LaunchBackgroundApplication(
#if !BUILDFLAG(IS_CHROMEOS) #if !BUILDFLAG(IS_CHROMEOS)
apps::AppServiceProxyFactory::GetForProfile(profile) apps::AppServiceProxyFactory::GetForProfile(profile)
->BrowserAppLauncher() ->BrowserAppLauncher()
->LaunchAppWithParams(CreateAppLaunchParamsUserContainer( ->LaunchAppWithParams(
profile, extension, WindowOpenDisposition::NEW_FOREGROUND_TAB, CreateAppLaunchParamsUserContainer(
apps::LaunchSource::kFromBackgroundMode)); profile, extension, WindowOpenDisposition::NEW_FOREGROUND_TAB,
apps::LaunchSource::kFromBackgroundMode),
base::DoNothing());
#else #else
// background mode is not used in Chrome OS platform. // background mode is not used in Chrome OS platform.
// TODO(crbug.com/1291803): Remove the background mode manager from Chrome OS // TODO(crbug.com/1291803): Remove the background mode manager from Chrome OS
@ -874,6 +870,8 @@ void BackgroundModeManager::UpdateEnableLaunchOnStartup() {
EnableLaunchOnStartup(*launch_on_startup_enabled_); EnableLaunchOnStartup(*launch_on_startup_enabled_);
} }
namespace {
// Gets the image for the status tray icon, at the correct size for the current // Gets the image for the status tray icon, at the correct size for the current
// platform and display settings. // platform and display settings.
gfx::ImageSkia GetStatusTrayIcon() { gfx::ImageSkia GetStatusTrayIcon() {
@ -906,6 +904,8 @@ gfx::ImageSkia GetStatusTrayIcon() {
#endif #endif
} }
} // namespace
void BackgroundModeManager::CreateStatusTrayIcon() { void BackgroundModeManager::CreateStatusTrayIcon() {
// Only need status icons on windows/linux. ChromeOS doesn't allow exiting // Only need status icons on windows/linux. ChromeOS doesn't allow exiting
// Chrome and Mac can use the dock icon instead. // Chrome and Mac can use the dock icon instead.