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

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

Issue 2744253004: NTP: clang-format (Closed)
Patch Set: Created 3 years, 9 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_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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 sent = 0; // Reset on day change. 98 sent = 0; // Reset on day change.
99 } 99 }
100 prefs->SetInteger(prefs::kContentSuggestionsNotificationsSentCount, sent + 1); 100 prefs->SetInteger(prefs::kContentSuggestionsNotificationsSentCount, sent + 1);
101 } 101 }
102 102
103 } // namespace 103 } // namespace
104 104
105 class ContentSuggestionsNotifierService::NotifyingObserver 105 class ContentSuggestionsNotifierService::NotifyingObserver
106 : public ContentSuggestionsService::Observer { 106 : public ContentSuggestionsService::Observer {
107 public: 107 public:
108 NotifyingObserver(ContentSuggestionsService* service, 108 NotifyingObserver(ContentSuggestionsService* service, Profile* profile)
109 Profile* profile)
110 : service_(service), 109 : service_(service),
111 profile_(profile), 110 profile_(profile),
112 app_status_listener_(base::Bind(&NotifyingObserver::AppStatusChanged, 111 app_status_listener_(base::Bind(&NotifyingObserver::AppStatusChanged,
113 base::Unretained(this))), 112 base::Unretained(this))),
114 weak_ptr_factory_(this) {} 113 weak_ptr_factory_(this) {}
115 114
116 void OnNewSuggestions(Category category) override { 115 void OnNewSuggestions(Category category) override {
117 if (!ShouldNotifyInState(app_status_listener_.GetState())) { 116 if (!ShouldNotifyInState(app_status_listener_.GetState())) {
118 DVLOG(1) << "Suppressed notification because Chrome is frontmost"; 117 DVLOG(1) << "Suppressed notification because Chrome is frontmost";
119 return; 118 return;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 registry->RegisterIntegerPref( 256 registry->RegisterIntegerPref(
258 prefs::kContentSuggestionsConsecutiveIgnoredPrefName, 0); 257 prefs::kContentSuggestionsConsecutiveIgnoredPrefName, 0);
259 registry->RegisterIntegerPref(prefs::kContentSuggestionsNotificationsSentDay, 258 registry->RegisterIntegerPref(prefs::kContentSuggestionsNotificationsSentDay,
260 0); 259 0);
261 registry->RegisterIntegerPref( 260 registry->RegisterIntegerPref(
262 prefs::kContentSuggestionsNotificationsSentCount, 0); 261 prefs::kContentSuggestionsNotificationsSentCount, 0);
263 262
264 // TODO(sfiera): remove after M62; no longer (and never really) used. 263 // TODO(sfiera): remove after M62; no longer (and never really) used.
265 registry->RegisterStringPref(kNotificationIDWithinCategory, std::string()); 264 registry->RegisterStringPref(kNotificationIDWithinCategory, std::string());
266 } 265 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/ntp/most_visited_sites_bridge.cc » ('j') | components/ntp_snippets/category.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698