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

Side by Side Diff: components/ntp_snippets/remote/remote_suggestions_status_service.h

Issue 2667623002: [Remote suggestions] Clean up variation params in the status service (Closed)
Patch Set: Rebase Created 3 years, 10 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 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_STATUS_SERVICE_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_STATUS_SERVICE_H_
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_STATUS_SERVICE_H_ 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_STATUS_SERVICE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/scoped_observer.h" 10 #include "base/scoped_observer.h"
11 #include "components/prefs/pref_change_registrar.h" 11 #include "components/prefs/pref_change_registrar.h"
12 12
13 class PrefRegistrySimple; 13 class PrefRegistrySimple;
14 class PrefService; 14 class PrefService;
15 class SigninManagerBase; 15 class SigninManagerBase;
16 16
17 namespace ntp_snippets { 17 namespace ntp_snippets {
18 18
19 enum class RemoteSuggestionsStatus : int { 19 enum class RemoteSuggestionsStatus : int {
20 // Suggestions are enabled and the user is signed in. 20 // Suggestions are enabled and the user is signed in.
21 ENABLED_AND_SIGNED_IN, 21 ENABLED_AND_SIGNED_IN,
22 // Suggestions are enabled; the user is signed out (sign-in is not required). 22 // Suggestions are enabled; the user is signed out (sign-in is not required).
23 ENABLED_AND_SIGNED_OUT, 23 ENABLED_AND_SIGNED_OUT,
24 // Suggestions have been disabled as part of the service configuration. 24 // Suggestions have been disabled as part of the service configuration.
25 EXPLICITLY_DISABLED, 25 EXPLICITLY_DISABLED,
26 // The user is not signed in, but sign-in is required.
27 SIGNED_OUT_AND_DISABLED,
28 }; 26 };
29 27
30 // Aggregates data from preferences and signin to notify the provider of 28 // Aggregates data from preferences and signin to notify the provider of
31 // relevant changes in their states. 29 // relevant changes in their states.
32 class RemoteSuggestionsStatusService { 30 class RemoteSuggestionsStatusService {
33 public: 31 public:
34 using StatusChangeCallback = 32 using StatusChangeCallback =
35 base::Callback<void(RemoteSuggestionsStatus old_status, 33 base::Callback<void(RemoteSuggestionsStatus old_status,
36 RemoteSuggestionsStatus new_status)>; 34 RemoteSuggestionsStatus new_status)>;
37 35
(...skipping 26 matching lines...) Expand all
64 62
65 void OnStateChanged(RemoteSuggestionsStatus new_status); 63 void OnStateChanged(RemoteSuggestionsStatus new_status);
66 64
67 bool IsSignedIn() const; 65 bool IsSignedIn() const;
68 66
69 RemoteSuggestionsStatus GetStatusFromDeps() const; 67 RemoteSuggestionsStatus GetStatusFromDeps() const;
70 68
71 RemoteSuggestionsStatus status_; 69 RemoteSuggestionsStatus status_;
72 StatusChangeCallback status_change_callback_; 70 StatusChangeCallback status_change_callback_;
73 71
74 bool require_signin_;
75 SigninManagerBase* signin_manager_; 72 SigninManagerBase* signin_manager_;
76 PrefService* pref_service_; 73 PrefService* pref_service_;
77 74
78 PrefChangeRegistrar pref_change_registrar_; 75 PrefChangeRegistrar pref_change_registrar_;
79 76
80 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsStatusService); 77 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsStatusService);
81 }; 78 };
82 79
83 } // namespace ntp_snippets 80 } // namespace ntp_snippets
84 81
85 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_STATUS_SERVICE_H_ 82 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_STATUS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698