feat: custom toast xml and failure reporting for notifications (#25401)

* allow custom toast xml and report failures

* docs

* tests

* don't use namespaces

* lint doesn't like trailing commas

* addressing feedback
This commit is contained in:
bitdisaster 2020-09-29 12:20:10 -07:00 committed by GitHub
parent d2282ac51a
commit b43859f098
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 282 additions and 219 deletions

View file

@ -52,6 +52,7 @@ class Notification : public gin::Wrappable<Notification>,
void NotificationDisplayed() override;
void NotificationDestroyed() override;
void NotificationClosed() override;
void NotificationFailed(const std::string& error) override;
// gin::Wrappable
static gin::WrapperInfo kWrapperInfo;
@ -75,6 +76,7 @@ class Notification : public gin::Wrappable<Notification>,
base::string16 GetSound() const;
std::vector<electron::NotificationAction> GetActions() const;
base::string16 GetCloseButtonText() const;
base::string16 GetToastXml() const;
// Prop Setters
void SetTitle(const base::string16& new_title);
@ -88,6 +90,7 @@ class Notification : public gin::Wrappable<Notification>,
void SetSound(const base::string16& sound);
void SetActions(const std::vector<electron::NotificationAction>& actions);
void SetCloseButtonText(const base::string16& text);
void SetToastXml(const base::string16& text);
private:
base::string16 title_;
@ -104,6 +107,7 @@ class Notification : public gin::Wrappable<Notification>,
base::string16 urgency_;
std::vector<electron::NotificationAction> actions_;
base::string16 close_button_text_;
base::string16 toast_xml_;
electron::NotificationPresenter* presenter_;