Skip to content

Commit

Permalink
[//chrome] Register CrostiniExportImportServiceFactory
Browse files Browse the repository at this point in the history
The enforcement of "no late registration of KeyedService factories in
//chrome" exposed the lazy registration of
CrostiniExportImportServiceFactory. This CL adds registration of that
factory at the proper point.

Bug: 1412439
Change-Id: I9298872486ee3529bff25d36ae57be1812a577e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4323657
Auto-Submit: Colin Blundell <blundell@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1115025}
  • Loading branch information
colinblundell authored and Chromium LUCI CQ committed Mar 9, 2023
1 parent 7df9b95 commit b9f1646
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chrome/browser/ash/crostini/crostini_export_import.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class CrostiniExportImportFactory : public ProfileKeyedServiceFactory {
}
};

void CrostiniExportImport::EnsureFactoryBuilt() {
CrostiniExportImportFactory::GetInstance();
}

CrostiniExportImport* CrostiniExportImport::GetForProfile(Profile* profile) {
return CrostiniExportImportFactory::GetForProfile(profile);
}
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/ash/crostini/crostini_export_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ class CrostiniExportImport : public KeyedService,
OnceTrackerFactory tracker_factory;
};

// Call this method to ensure that the factory for this KeyedService is built
// (necessary for embedders that disallow lazy initialization of factories).
static void EnsureFactoryBuilt();

static CrostiniExportImport* GetForProfile(Profile* profile);

explicit CrostiniExportImport(Profile* profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
#include "chrome/browser/ash/account_manager/account_apps_availability_factory.h"
#include "chrome/browser/ash/app_list/app_list_syncable_service_factory.h"
#include "chrome/browser/ash/browser_context_keyed_service_factories.h"
#include "chrome/browser/ash/crostini/crostini_export_import.h"
#include "chrome/browser/ash/login/security_token_session_controller_factory.h"
#include "chrome/browser/ash/system_extensions/api/window_management/cros_window_management_context_factory.h"
#include "chrome/browser/ash/system_extensions/system_extensions_provider_factory.h"
Expand Down Expand Up @@ -711,6 +712,7 @@ void ChromeBrowserMainExtraPartsProfiles::
NavigationPredictorKeyedServiceFactory::GetInstance();
#if BUILDFLAG(IS_CHROMEOS_ASH)
NearbySharingServiceFactory::GetInstance();
crostini::CrostiniExportImport::EnsureFactoryBuilt();
#endif
NotificationDisplayServiceFactory::GetInstance();
NotificationMetricsLoggerFactory::GetInstance();
Expand Down

0 comments on commit b9f1646

Please sign in to comment.