NotificationPlatformBridge should be a lot simpler. For example, Display() should only have a Notification and a Metadata argument, all considerations of profile and notification type are not relevant to native notification systems and should be a higher level concern (i.e. NativeNotificationDisplayService). As it stands, each NPB implementation has to duplicate a lot of code converting notification IDs and tracking active notifications. This work should be done in NativeNotificationDisplayService.
NativeNotificationDisplayService can implement a simple interface that acts as its API for each NPB implementation, along the lines of
class NotificationPlatformBridgeDelegate {
public:
virtual void HandleNotificationClosed(const std::string& id,
bool by_user) = 0;
virtual void HandleNotificationClicked(const std::string& id) = 0;
virtual void HandleNotificationButtonClicked(const std::string& id,
int button_index) = 0;
};
Connecting the events to the NotificationDisplayService for the correct profile, tracking the NotificationCommon::Type, etc., will then not be necessary for each NPB.
Comment 1 by est...@chromium.org
, Oct 19 2017