| 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 #include "chrome/browser/android/ntp/content_suggestions_notification_helper.h" | 5 #include "chrome/browser/android/ntp/content_suggestions_notification_helper.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 bool ContentSuggestionsNotificationHelper::IsDisabledForProfile( | 103 bool ContentSuggestionsNotificationHelper::IsDisabledForProfile( |
| 104 Profile* profile) { | 104 Profile* profile) { |
| 105 return ntp_snippets::IsDisabledForProfile(profile); | 105 return ntp_snippets::IsDisabledForProfile(profile); |
| 106 } | 106 } |
| 107 | 107 |
| 108 // static | 108 // static |
| 109 bool ContentSuggestionsNotificationHelper::Register(JNIEnv* env) { | 109 bool ContentSuggestionsNotificationHelper::Register(JNIEnv* env) { |
| 110 return RegisterNativesImpl(env); | 110 return RegisterNativesImpl(env); |
| 111 } | 111 } |
| 112 | 112 |
| 113 static void RecordNotificationOptOut(JNIEnv* env, |
| 114 const JavaParamRef<jclass>& class_object, |
| 115 jint reason) { |
| 116 RecordContentSuggestionsNotificationOptOut( |
| 117 static_cast<ContentSuggestionsNotificationOptOut>(reason)); |
| 118 } |
| 119 |
| 120 static void RecordNotificationAction(JNIEnv* env, |
| 121 const JavaParamRef<jclass>& class_object, |
| 122 jint action) { |
| 123 RecordContentSuggestionsNotificationAction( |
| 124 static_cast<ContentSuggestionsNotificationAction>(action)); |
| 125 } |
| 126 |
| 113 static void ReceiveFlushedMetrics(JNIEnv* env, | 127 static void ReceiveFlushedMetrics(JNIEnv* env, |
| 114 const JavaParamRef<jclass>& class_object, | 128 const JavaParamRef<jclass>& class_object, |
| 115 jint tap_count, | 129 jint tap_count, |
| 116 jint dismissal_count, | 130 jint dismissal_count, |
| 117 jint hide_deadline_count, | 131 jint hide_deadline_count, |
| 118 jint hide_expiry_count, | 132 jint hide_expiry_count, |
| 119 jint hide_frontmost_count, | 133 jint hide_frontmost_count, |
| 120 jint hide_disabled_count, | 134 jint hide_disabled_count, |
| 121 jint hide_shutdown_count, | 135 jint hide_shutdown_count, |
| 122 jint consecutive_ignored) { | 136 jint consecutive_ignored) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 181 } |
| 168 prefs->SetInteger(prefs::kContentSuggestionsConsecutiveIgnoredPrefName, | 182 prefs->SetInteger(prefs::kContentSuggestionsConsecutiveIgnoredPrefName, |
| 169 consecutive_ignored); | 183 consecutive_ignored); |
| 170 const bool is_disabled = IsDisabledForProfile(profile); | 184 const bool is_disabled = IsDisabledForProfile(profile); |
| 171 if (!was_disabled && is_disabled) { | 185 if (!was_disabled && is_disabled) { |
| 172 RecordContentSuggestionsNotificationOptOut(CONTENT_SUGGESTIONS_IMPLICIT); | 186 RecordContentSuggestionsNotificationOptOut(CONTENT_SUGGESTIONS_IMPLICIT); |
| 173 } | 187 } |
| 174 } | 188 } |
| 175 | 189 |
| 176 } // namespace ntp_snippets | 190 } // namespace ntp_snippets |
| OLD | NEW |