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

Unified Diff: components/ntp_snippets/remote/ntp_snippets_status_service.h

Issue 2519053002: 📰 Let the backend trigger sign in related refreshes (Closed)
Patch Set: Fix iOS build Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/remote/ntp_snippets_status_service.h
diff --git a/components/ntp_snippets/remote/ntp_snippets_status_service.h b/components/ntp_snippets/remote/ntp_snippets_status_service.h
index 2f8f47a76356edc691709c67b0c6eddc5cb96b49..6f19d038bef485dc51ef0e42127b45ee6dae65ff 100644
--- a/components/ntp_snippets/remote/ntp_snippets_status_service.h
+++ b/components/ntp_snippets/remote/ntp_snippets_status_service.h
@@ -9,10 +9,10 @@
#include "base/gtest_prod_util.h"
#include "base/scoped_observer.h"
#include "components/prefs/pref_change_registrar.h"
-#include "components/signin/core/browser/signin_manager.h"
class PrefRegistrySimple;
class PrefService;
+class SigninManagerBase;
namespace ntp_snippets {
@@ -29,7 +29,7 @@ enum class SnippetsStatus : int {
// Aggregates data from preferences and signin to notify the snippet service of
// relevant changes in their states.
-class NTPSnippetsStatusService : public SigninManagerBase::Observer {
+class NTPSnippetsStatusService {
public:
using SnippetsStatusChangeCallback =
base::Callback<void(SnippetsStatus /*old_status*/,
@@ -38,7 +38,7 @@ class NTPSnippetsStatusService : public SigninManagerBase::Observer {
NTPSnippetsStatusService(SigninManagerBase* signin_manager,
PrefService* pref_service);
- ~NTPSnippetsStatusService() override;
+ virtual ~NTPSnippetsStatusService();
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
@@ -46,16 +46,14 @@ class NTPSnippetsStatusService : public SigninManagerBase::Observer {
// called when a significant change in state is detected.
void Init(const SnippetsStatusChangeCallback& callback);
+ // To be called when the signin state changed. Will compute the new
+ // state considering the initialisation configuration and the preferences,
+ // and notify via the registered callback if appropriate.
+ void OnSignInStateChanged();
+
private:
FRIEND_TEST_ALL_PREFIXES(NTPSnippetsStatusServiceTest, DisabledViaPref);
- // SigninManagerBase::Observer implementation
- void GoogleSigninSucceeded(const std::string& account_id,
- const std::string& username,
- const std::string& password) override;
- void GoogleSignedOut(const std::string& account_id,
- const std::string& username) override;
-
// Callback for the PrefChangeRegistrar.
void OnSnippetsEnabledChanged();
@@ -74,10 +72,6 @@ class NTPSnippetsStatusService : public SigninManagerBase::Observer {
PrefChangeRegistrar pref_change_registrar_;
- // The observer for the SigninManager.
- ScopedObserver<SigninManagerBase, SigninManagerBase::Observer>
- signin_observer_;
-
DISALLOW_COPY_AND_ASSIGN(NTPSnippetsStatusService);
};

Powered by Google App Engine
This is Rietveld 408576698