Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: chrome/browser/notifications/notification_handler.h

Issue 2093953002: Introduce a new API to handle native notification clicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: initial review Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "chrome/browser/notifications/notification_common.h"
12
13 class NotificationDelegate;
14 class Profile;
15
16 // Interface that enables the different kind of notifications
17 // to process operations coming from the user.
18 // Whenever a notification is clicked or closed or a button is pressed
19 // the right kind of NotificationHandler will deal with the operation.
Peter Beverloo 2016/07/05 14:25:34 nit: remove lines 18/19- it's partly implied, part
Miguel Garcia 2016/07/05 17:12:52 Done.
20 class NotificationHandler {
21 public:
22 virtual ~NotificationHandler() {}
23
24 // Close a notification. This method works both for user generated
25 // close events or for notifications closed programatically.
26 // This is driven by the |by_user| flag.
Peter Beverloo 2016/07/05 14:25:34 This method observes notifications being closed fo
Miguel Garcia 2016/07/05 17:12:53 Added the On* prefix
27 virtual void Close(Profile* profile,
28 const std::string& origin,
29 const std::string& notification_id,
30 bool by_user) = 0;
31
32 // Click on a notification or one of its buttons, depending on |action_index|.
33 virtual void Click(Profile* profile,
34 const std::string& origin,
35 const std::string& notification_id,
36 int action_index) = 0;
37
38 // Open notification settings.
39 virtual void Settings(Profile* profile) = 0;
Peter Beverloo 2016/07/05 14:25:34 nit: OpenSettings
Miguel Garcia 2016/07/05 17:12:52 Done.
40
41 // Registers a |Notification| object with this handler.
42 virtual void RegisterNotification(const std::string& notification_id,
43 NotificationDelegate* delegate) = 0;
44
45 // Return the kind of notifications the class knows how to handle.
46 virtual NotificationCommon::Type NotificationType() = 0;
47 };
48
49 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698