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

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

Issue 2744253004: NTP: clang-format (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
« no previous file with comments | « no previous file | chrome/browser/android/ntp/most_visited_sites_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_notifier_service.h" 5 #include "chrome/browser/android/ntp/content_suggestions_notifier_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/android/application_status_listener.h" 9 #include "base/android/application_status_listener.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 sent = 0; // Reset on day change. 97 sent = 0; // Reset on day change.
98 } 98 }
99 prefs->SetInteger(prefs::kContentSuggestionsNotificationsSentCount, sent + 1); 99 prefs->SetInteger(prefs::kContentSuggestionsNotificationsSentCount, sent + 1);
100 } 100 }
101 101
102 } // namespace 102 } // namespace
103 103
104 class ContentSuggestionsNotifierService::NotifyingObserver 104 class ContentSuggestionsNotifierService::NotifyingObserver
105 : public ContentSuggestionsService::Observer { 105 : public ContentSuggestionsService::Observer {
106 public: 106 public:
107 NotifyingObserver(ContentSuggestionsService* service, 107 NotifyingObserver(ContentSuggestionsService* service, Profile* profile)
108 Profile* profile)
109 : service_(service), 108 : service_(service),
110 profile_(profile), 109 profile_(profile),
111 app_status_listener_(base::Bind(&NotifyingObserver::AppStatusChanged, 110 app_status_listener_(base::Bind(&NotifyingObserver::AppStatusChanged,
112 base::Unretained(this))), 111 base::Unretained(this))),
113 weak_ptr_factory_(this) {} 112 weak_ptr_factory_(this) {}
114 113
115 void OnNewSuggestions(Category category) override { 114 void OnNewSuggestions(Category category) override {
116 if (!ShouldNotifyInState(app_status_listener_.GetState())) { 115 if (!ShouldNotifyInState(app_status_listener_.GetState())) {
117 DVLOG(1) << "Suppressed notification because Chrome is frontmost"; 116 DVLOG(1) << "Suppressed notification because Chrome is frontmost";
118 return; 117 return;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 registry->RegisterIntegerPref( 245 registry->RegisterIntegerPref(
247 prefs::kContentSuggestionsConsecutiveIgnoredPrefName, 0); 246 prefs::kContentSuggestionsConsecutiveIgnoredPrefName, 0);
248 registry->RegisterIntegerPref(prefs::kContentSuggestionsNotificationsSentDay, 247 registry->RegisterIntegerPref(prefs::kContentSuggestionsNotificationsSentDay,
249 0); 248 0);
250 registry->RegisterIntegerPref( 249 registry->RegisterIntegerPref(
251 prefs::kContentSuggestionsNotificationsSentCount, 0); 250 prefs::kContentSuggestionsNotificationsSentCount, 0);
252 251
253 // TODO(sfiera): remove after M62; no longer (and never really) used. 252 // TODO(sfiera): remove after M62; no longer (and never really) used.
254 registry->RegisterStringPref(kNotificationIDWithinCategory, std::string()); 253 registry->RegisterStringPref(kNotificationIDWithinCategory, std::string());
255 } 254 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/ntp/most_visited_sites_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698