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

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

Issue 2831553003: List our features in ntp_snippets::kAllFeatures (Closed)
Patch Set: rebase Created 3 years, 8 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 #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"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h"
14 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "components/ntp_snippets/features.h"
17 #include "components/prefs/pref_service.h" 17 #include "components/prefs/pref_service.h"
18 #include "components/variations/variations_associated_data.h" 18 #include "components/variations/variations_associated_data.h"
19 #include "jni/ContentSuggestionsNotificationHelper_jni.h" 19 #include "jni/ContentSuggestionsNotificationHelper_jni.h"
20 #include "ui/gfx/android/java_bitmap.h" 20 #include "ui/gfx/android/java_bitmap.h"
21 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
22 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
23 23
24 using base::android::JavaParamRef; 24 using base::android::JavaParamRef;
25 using params::ntp_snippets::kNotificationsFeature; 25 using ntp_snippets::kNotificationsFeature;
26 using params::ntp_snippets::kNotificationsIgnoredLimitParam; 26 using ntp_snippets::kNotificationsIgnoredLimitParam;
27 using params::ntp_snippets::kNotificationsIgnoredDefaultLimit; 27 using ntp_snippets::kNotificationsIgnoredDefaultLimit;
28 28
29 namespace ntp_snippets { 29 namespace ntp_snippets {
30 30
31 namespace { 31 namespace {
32 32
33 bool IsDisabledForProfile(Profile* profile) { 33 bool IsDisabledForProfile(Profile* profile) {
34 PrefService* prefs = profile->GetPrefs(); 34 PrefService* prefs = profile->GetPrefs();
35 if (!prefs->GetBoolean(prefs::kContentSuggestionsNotificationsEnabled)) { 35 if (!prefs->GetBoolean(prefs::kContentSuggestionsNotificationsEnabled)) {
36 return true; 36 return true;
37 } 37 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 prefs->SetInteger(prefs::kContentSuggestionsConsecutiveIgnoredPrefName, 182 prefs->SetInteger(prefs::kContentSuggestionsConsecutiveIgnoredPrefName,
183 consecutive_ignored); 183 consecutive_ignored);
184 const bool is_disabled = IsDisabledForProfile(profile); 184 const bool is_disabled = IsDisabledForProfile(profile);
185 if (!was_disabled && is_disabled) { 185 if (!was_disabled && is_disabled) {
186 RecordContentSuggestionsNotificationOptOut(CONTENT_SUGGESTIONS_IMPLICIT); 186 RecordContentSuggestionsNotificationOptOut(CONTENT_SUGGESTIONS_IMPLICIT);
187 } 187 }
188 } 188 }
189 189
190 } // namespace ntp_snippets 190 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_feature_list.cc ('k') | chrome/browser/android/ntp/content_suggestions_notifier_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698