| OLD | NEW |
| 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 <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 14 | 15 |
| 16 class Profile; |
| 17 |
| 15 namespace gfx { | 18 namespace gfx { |
| 16 class Image; | 19 class Image; |
| 17 } // namespace gfx | 20 } // namespace gfx |
| 18 | 21 |
| 19 namespace ntp_snippets { | 22 namespace ntp_snippets { |
| 20 | 23 |
| 21 class ContentSuggestionsNotificationHelper { | 24 class ContentSuggestionsNotificationHelper { |
| 22 public: | 25 public: |
| 23 static void OpenURL(const GURL& url); | |
| 24 static void SendNotification(const GURL& url, | 26 static void SendNotification(const GURL& url, |
| 25 const base::string16& title, | 27 const base::string16& title, |
| 26 const base::string16& text, | 28 const base::string16& text, |
| 27 const gfx::Image& image, | 29 const gfx::Image& image, |
| 28 base::Time timeout_at); | 30 base::Time timeout_at); |
| 29 static void HideAllNotifications(); | 31 static void HideAllNotifications(); |
| 30 | 32 |
| 33 // 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 |
| 35 // the last time it was running. (Harmless to call more often, though) |
| 36 // |
| 37 // Also updates the "consecutive ignored" preference, which is computed from |
| 38 // the actions taken on notifications, and maybe the "opt outs" metric, which |
| 39 // is computed in turn from that. |
| 40 static void FlushCachedMetrics(); |
| 41 |
| 42 // True if the user has ignored enough notifications that we no longer think |
| 43 // that the user is interested in them. |
| 44 static bool IsDisabledForProfile(Profile* profile); |
| 45 |
| 46 // Registers JNI methods. |
| 47 static bool Register(JNIEnv* env); |
| 48 |
| 31 private: | 49 private: |
| 32 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSuggestionsNotificationHelper); | 50 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSuggestionsNotificationHelper); |
| 33 }; | 51 }; |
| 34 | 52 |
| 35 } // namespace ntp_snippets | 53 } // namespace ntp_snippets |
| 36 | 54 |
| 37 #endif // CHROME_BROWSER_ANDROID_NTP_CONTENT_SUGGESTIONS_NOTIFICATION_HELPER_H_ | 55 #endif // CHROME_BROWSER_ANDROID_NTP_CONTENT_SUGGESTIONS_NOTIFICATION_HELPER_H_ |
| OLD | NEW |