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

Side by Side Diff: chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h

Issue 26943002: Add UMA histogram data representing the Synced Notifications feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced Notifications UMA - fix histograms.xml formatting Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_DELEGATE_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_DELEGATE_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_DELEGATE_H_
7 7
8 #include <map>
8 #include <string> 9 #include <string>
9 10
10 #include "chrome/browser/notifications/notification_delegate.h" 11 #include "chrome/browser/notifications/notification_delegate.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 namespace notifier { 14 namespace notifier {
14 15
16 enum SyncedNotificationActionType {
17 SYNCED_NOTIFICATION_ACTION_UNKNOWN,
18 SYNCED_NOTIFICATION_ACTION_CLICK,
19 SYNCED_NOTIFICATION_ACTION_BUTTON_CLICK,
20 SYNCED_NOTIFICATION_ACTION_CLOSE_BY_USER,
21 SYNCED_NOTIFICATION_ACTION_CLOSE_BY_SYSTEM,
22 SYNCED_NOTIFICATION_ACTION_TOAST_TIMEOUT,
23 // NOTE: Add new action types only immediately above this line. Also,
24 // make sure the enum list in tools/histogram/histograms.xml is
25 // updated with any change in here.
26 SYNCED_NOTIFICATION_ACTION_COUNT
27 };
28
15 class ChromeNotifierService; 29 class ChromeNotifierService;
16 30
17 // ChromeNotifierDelegate is a NotificationDelegate which catches 31 // ChromeNotifierDelegate is a NotificationDelegate which catches
18 // responses from the NotificationUIManager when a notification 32 // responses from the NotificationUIManager when a notification
19 // has been closed. 33 // has been closed.
20 34
21 class ChromeNotifierDelegate : public NotificationDelegate { 35 class ChromeNotifierDelegate : public NotificationDelegate {
22 public: 36 public:
23 // We use an id instead of a notification so we can check to see if the 37 // We use an id instead of a notification so we can check to see if the
24 // notification still exists before acting on it instead of using a ref count. 38 // notification still exists before acting on it instead of using a ref count.
25 explicit ChromeNotifierDelegate(const std::string& notification_id, 39 explicit ChromeNotifierDelegate(const std::string& notification_id,
26 ChromeNotifierService* notifier); 40 ChromeNotifierService* notifier);
27 41
28 // NotificationDelegate interface. 42 // NotificationDelegate interface.
29 virtual void Display() OVERRIDE {} 43 virtual void Display() OVERRIDE {}
30 virtual void Error() OVERRIDE {} 44 virtual void Error() OVERRIDE {}
31 virtual void Close(bool by_user) OVERRIDE; 45 virtual void Close(bool by_user) OVERRIDE;
32 virtual void Click() OVERRIDE; 46 virtual void Click() OVERRIDE;
33 virtual void ButtonClick(int button_index) OVERRIDE; 47 virtual void ButtonClick(int button_index) OVERRIDE;
34 virtual std::string id() const OVERRIDE; 48 virtual std::string id() const OVERRIDE;
35 49
36 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE; 50 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE;
37 51
52 void CollectAction(SyncedNotificationActionType type);
53
38 private: 54 private:
39 virtual ~ChromeNotifierDelegate(); 55 virtual ~ChromeNotifierDelegate();
40 void NavigateToUrl(const GURL& destination) const; 56 void NavigateToUrl(const GURL& destination) const;
41 57
42 const std::string notification_id_; 58 const std::string notification_id_;
43 ChromeNotifierService* const chrome_notifier_; 59 ChromeNotifierService* const chrome_notifier_;
44 60
45 DISALLOW_COPY_AND_ASSIGN(ChromeNotifierDelegate); 61 DISALLOW_COPY_AND_ASSIGN(ChromeNotifierDelegate);
46 }; 62 };
47 63
48 } // namespace notifier 64 } // namespace notifier
49 65
50 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_DELEGATE_H _ 66 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_DELEGATE_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698