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

Unified Diff: components/ntp_snippets/ntp_snippets_status_service.h

Issue 2191343002: 📰 Remove SnippetService's dependency on Sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update some doc, show NO_SNIPPETS instead of SIGNIN when during INITIALIZING state Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/ntp_snippets_status_service.h
diff --git a/components/ntp_snippets/ntp_snippets_status_service.h b/components/ntp_snippets/ntp_snippets_status_service.h
index 5b0fcb85758ce3b70ba4b64aafb72a5d4e085908..1557bb2843fde00d0a8923060057d1be3624344d 100644
--- a/components/ntp_snippets/ntp_snippets_status_service.h
+++ b/components/ntp_snippets/ntp_snippets_status_service.h
@@ -9,15 +9,10 @@
#include "base/gtest_prod_util.h"
#include "base/scoped_observer.h"
#include "components/prefs/pref_change_registrar.h"
-#include "components/sync_driver/sync_service_observer.h"
+#include "components/signin/core/browser/signin_manager.h"
class PrefRegistrySimple;
class PrefService;
-class SigninManagerBase;
-
-namespace sync_driver {
-class SyncService;
-}
namespace ntp_snippets {
@@ -28,24 +23,15 @@ enum class DisabledReason : int {
EXPLICITLY_DISABLED,
// The user is not signed in, and the service requires it to be enabled.
SIGNED_OUT,
- // Sync is not enabled, and the service requires it to be enabled.
- SYNC_DISABLED,
- // The service requires passphrase encryption to be disabled.
- PASSPHRASE_ENCRYPTION_ENABLED,
- // History sync is not enabled, and the service requires it to be enabled.
- HISTORY_SYNC_DISABLED,
- // The sync service is not completely initialized, and the status is unknown.
- HISTORY_SYNC_STATE_UNKNOWN
};
-// Aggregates data from sync and signin to notify the snippet service of
+// Aggregates data from preferences and signin to notify the snippet service of
// relevant changes in their states.
-class NTPSnippetsStatusService : public sync_driver::SyncServiceObserver {
+class NTPSnippetsStatusService : public SigninManagerBase::Observer {
public:
typedef base::Callback<void(DisabledReason)> DisabledReasonChangeCallback;
NTPSnippetsStatusService(SigninManagerBase* signin_manager,
- sync_driver::SyncService* sync_service,
PrefService* pref_service);
~NTPSnippetsStatusService() override;
@@ -60,12 +46,18 @@ class NTPSnippetsStatusService : public sync_driver::SyncServiceObserver {
private:
FRIEND_TEST_ALL_PREFIXES(NTPSnippetsStatusServiceTest,
- SyncStateCompatibility);
+ SigninStateCompatibility);
FRIEND_TEST_ALL_PREFIXES(NTPSnippetsStatusServiceTest, DisabledViaPref);
- // sync_driver::SyncServiceObserver implementation. Also used as a callback
- // for the PrefChangeRegistrar.
- void OnStateChanged() override;
+ // 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 OnStateChanged();
DisabledReason GetDisabledReasonFromDeps() const;
@@ -73,15 +65,13 @@ class NTPSnippetsStatusService : public sync_driver::SyncServiceObserver {
DisabledReasonChangeCallback disabled_reason_change_callback_;
SigninManagerBase* signin_manager_;
- sync_driver::SyncService* sync_service_;
PrefService* pref_service_;
PrefChangeRegistrar pref_change_registrar_;
- // The observer for the SyncService. When the sync state changes,
- // SyncService will call |OnStateChanged|.
- ScopedObserver<sync_driver::SyncService, sync_driver::SyncServiceObserver>
- sync_service_observer_;
+ // The observer for the SigninManager.
+ ScopedObserver<SigninManagerBase, SigninManagerBase::Observer>
+ signin_observer_;
DISALLOW_COPY_AND_ASSIGN(NTPSnippetsStatusService);
};
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service_unittest.cc ('k') | components/ntp_snippets/ntp_snippets_status_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698