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

Side by Side Diff: chrome/browser/android/ntp/content_suggestions_notification_helper.h

Issue 2639553002: Track active notifications in Java (Closed)
Patch Set: FindBugs 2 Created 3 years, 11 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_ANDROID_NTP_CONTENT_SUGGESTIONS_NOTIFICATION_HELPER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_NTP_CONTENT_SUGGESTIONS_NOTIFICATION_HELPER_H_
6 #define CHROME_BROWSER_ANDROID_NTP_CONTENT_SUGGESTIONS_NOTIFICATION_HELPER_H_ 6 #define CHROME_BROWSER_ANDROID_NTP_CONTENT_SUGGESTIONS_NOTIFICATION_HELPER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chrome/browser/ntp_snippets/ntp_snippets_metrics.h"
15 #include "components/ntp_snippets/content_suggestion.h"
14 #include "url/gurl.h" 16 #include "url/gurl.h"
15 17
16 class Profile; 18 class Profile;
17 19
18 namespace gfx { 20 namespace gfx {
19 class Image; 21 class Image;
20 } // namespace gfx 22 } // namespace gfx
21 23
22 namespace ntp_snippets { 24 namespace ntp_snippets {
23 25
24 class ContentSuggestionsNotificationHelper { 26 class ContentSuggestionsNotificationHelper {
25 public: 27 public:
26 static void SendNotification(const GURL& url, 28 static bool SendNotification(const ContentSuggestion::ID& id,
29 const GURL& url,
27 const base::string16& title, 30 const base::string16& title,
28 const base::string16& text, 31 const base::string16& text,
29 const gfx::Image& image, 32 const gfx::Image& image,
30 base::Time timeout_at); 33 base::Time timeout_at);
31 static void HideAllNotifications(); 34 static void HideNotification(const ContentSuggestion::ID& id,
35 ContentSuggestionsNotificationAction why);
36 static void HideAllNotifications(ContentSuggestionsNotificationAction why);
32 37
33 // Moves metrics tracked in Java into native histograms. Should be called when 38 // Moves metrics tracked in Java into native histograms. Should be called when
34 // the native library starts up, to capture any actions that were taken since 39 // the native library starts up, to capture any actions that were taken since
35 // the last time it was running. (Harmless to call more often, though) 40 // the last time it was running. (Harmless to call more often, though)
36 // 41 //
37 // Also updates the "consecutive ignored" preference, which is computed from 42 // Also updates the "consecutive ignored" preference, which is computed from
38 // the actions taken on notifications, and maybe the "opt outs" metric, which 43 // the actions taken on notifications, and maybe the "opt outs" metric, which
39 // is computed in turn from that. 44 // is computed in turn from that.
40 static void FlushCachedMetrics(); 45 static void FlushCachedMetrics();
41 46
42 // True if the user has ignored enough notifications that we no longer think 47 // True if the user has ignored enough notifications that we no longer think
43 // that the user is interested in them. 48 // that the user is interested in them.
44 static bool IsDisabledForProfile(Profile* profile); 49 static bool IsDisabledForProfile(Profile* profile);
45 50
46 // Registers JNI methods. 51 // Registers JNI methods.
47 static bool Register(JNIEnv* env); 52 static bool Register(JNIEnv* env);
48 53
49 private: 54 private:
50 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSuggestionsNotificationHelper); 55 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSuggestionsNotificationHelper);
51 }; 56 };
52 57
53 } // namespace ntp_snippets 58 } // namespace ntp_snippets
54 59
55 #endif // CHROME_BROWSER_ANDROID_NTP_CONTENT_SUGGESTIONS_NOTIFICATION_HELPER_H_ 60 #endif // CHROME_BROWSER_ANDROID_NTP_CONTENT_SUGGESTIONS_NOTIFICATION_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698