Reland "[Extensions] Introduce common client initialization"
Relanding since the CL wasn't the cause of test flakiness.
Original change's description:
> [Extensions] Introduce common client initialization
>
> In order to extract apps-specific code from extensions, we'll need to
> be able to add extra information to the extensions client from outside
> extensions code. This will require having a centralized initialization
> for the extensions client.
>
> Introduce a single method, EnsureExtensionsClientInitialized(), which
> constructs and sets the ChromeExtensionsClient. Remove the old way of
> constructing the client, ChromeExtensionsClient::GetInstance(). Update
> all callers to construct the client via the new method.
>
> While we're at it, update the client to use base::NoDestructor instead
> of LazyInstance.
>
> Bug: 873937
> Change-Id: I47147cd5f33ea44079c0a319626c57f3c5813af8
> Reviewed-on: https://chromium-review.googlesource.com/1175459
> Commit-Queue: Devlin <[email protected]>
> Reviewed-by: Lei Zhang <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#583217}
[email protected],[email protected]
Bug: 873937
Change-Id: Idf8fdc2ca89e3f0e481fbfd310c5ebc6067311f1
Reviewed-on: https://chromium-review.googlesource.com/1181162
Reviewed-by: Devlin <[email protected]>
Commit-Queue: Devlin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#584461}
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 7073e030..00ba1980 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -171,6 +171,7 @@
#include "chrome/browser/extensions/event_router_forwarder.h"
#include "chrome/browser/media_galleries/media_file_system_registry.h"
#include "chrome/browser/ui/apps/chrome_app_window_client.h"
+#include "chrome/common/initialize_extensions_client.h"
#include "components/storage_monitor/storage_monitor.h"
#include "extensions/common/extension_l10n_util.h"
#endif
@@ -259,8 +260,7 @@
extension_event_router_forwarder_ =
base::MakeRefCounted<extensions::EventRouterForwarder>();
- extensions::ExtensionsClient::Set(
- extensions::ChromeExtensionsClient::GetInstance());
+ EnsureExtensionsClientInitialized();
extensions_browser_client_ =
std::make_unique<extensions::ChromeExtensionsBrowserClient>();