// Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_USER_EDUCATION_COMMON_PRODUCT_MESSAGING_CONTROLLER_H_ #define COMPONENTS_USER_EDUCATION_COMMON_PRODUCT_MESSAGING_CONTROLLER_H_ #include <map> #include "base/functional/callback_forward.h" #include "base/memory/weak_ptr.h" #include "ui/base/interaction/element_identifier.h" namespace user_education { class ProductMessagingController; // Opaque ID for required notices. // // Use DECLARE/DEFINE_REQUIRED_NOTICE_IDENTIFIER() below to create these for // your notices. RequiredNoticeId; // Place this in a .h file: #define DECLARE_REQUIRED_NOTICE_IDENTIFIER(name) … // Place this in a .cc file: #define DEFINE_REQUIRED_NOTICE_IDENTIFIER(name) … // This can be used in tests to avoid name conflicts. #define DEFINE_LOCAL_REQUIRED_NOTICE_IDENTIFIER(name) … namespace internal { // Special value in the "show after" list that causes the notice to happen last. DECLARE_REQUIRED_NOTICE_IDENTIFIER(…); } // namespace internal // The owner of this object currently has priority to show a required product // notice. It must be held while the notice is showing and released immediately // after the notice is dismissed. class [[nodiscard]] RequiredNoticePriorityHandle final { … }; // Callback when a required notice is ready to show. The notice should show // immediately. // // `handle` should be moved to a semi-permanent location and released when the // notice is dismissed/closes. Failure to hold or release the handle can cause // problems with User Education and other required notices. RequiredNoticeShowCallback; // Coordinates between critical product messaging (e.g. legal notices) that must // show in Chrome, to ensure that (a) they do not show over each other and (b) // no other spontaneous User Education experiences start at the same time. class ProductMessagingController final { … }; } // namespace user_education #endif // COMPONENTS_USER_EDUCATION_COMMON_PRODUCT_MESSAGING_CONTROLLER_H_