Stateless system permission retrieval
Making the design more flexible, so that each platform can implement
stateless or statefull permission retrieval.
Accesses are now done via a static api.
Bug: b/331784136
Change-Id: I3d14c58f6d9f914948231723e5efd47e8db37529
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5638632
Code-Coverage: [email protected] <[email protected]>
Reviewed-by: Greg Thompson <[email protected]>
Commit-Queue: Jan Láník <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1332921}
diff --git a/chrome/browser/global_features.h b/chrome/browser/global_features.h
index d91ece6..dd5e550 100644
--- a/chrome/browser/global_features.h
+++ b/chrome/browser/global_features.h
@@ -5,9 +5,14 @@
#ifndef CHROME_BROWSER_GLOBAL_FEATURES_H_
#define CHROME_BROWSER_GLOBAL_FEATURES_H_
+#include <memory.h>
+
#include "base/functional/callback.h"
#include "build/build_config.h"
+namespace system_permission_settings {
+class PlatformHandle;
+} // namespace system_permission_settings
namespace whats_new {
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
class WhatsNewRegistry;
@@ -36,6 +41,10 @@
// Public accessors for features, e.g.
// FooFeature* foo_feature() { return foo_feature_.get(); }
+ system_permission_settings::PlatformHandle*
+ system_permissions_platform_handle() {
+ return system_permissions_platform_handle_.get();
+ }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
whats_new::WhatsNewRegistry* whats_new_registry() {
return whats_new_registry_.get();
@@ -49,6 +58,8 @@
// testing. e.g.
// virtual std::unique_ptr<FooFeature> CreateFooFeature();
+ virtual std::unique_ptr<system_permission_settings::PlatformHandle>
+ CreateSystemPermissionsPlatformHandle();
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
virtual std::unique_ptr<whats_new::WhatsNewRegistry> CreateWhatsNewRegistry();
#endif
@@ -57,6 +68,8 @@
// Features will each have a controller. e.g.
// std::unique_ptr<FooFeature> foo_feature_;
+ std::unique_ptr<system_permission_settings::PlatformHandle>
+ system_permissions_platform_handle_;
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
std::unique_ptr<whats_new::WhatsNewRegistry> whats_new_registry_;
#endif