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

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

Issue 2556543003: Add another unittest for configuring sign-in dependency. (Closed)
Patch Set: Fix rebase Created 4 years 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"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // Starts listening for changes from the dependencies. |callback| will be 45 // Starts listening for changes from the dependencies. |callback| will be
46 // called when a significant change in state is detected. 46 // called when a significant change in state is detected.
47 void Init(const StatusChangeCallback& callback); 47 void Init(const StatusChangeCallback& callback);
48 48
49 // To be called when the signin state changed. Will compute the new 49 // To be called when the signin state changed. Will compute the new
50 // state considering the initialisation configuration and the preferences, 50 // state considering the initialisation configuration and the preferences,
51 // and notify via the registered callback if appropriate. 51 // and notify via the registered callback if appropriate.
52 void OnSignInStateChanged(); 52 void OnSignInStateChanged();
53 53
54 private: 54 private:
55 FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsStatusServiceTest,
56 SigninNeededIfSpecifiedByParam);
57 FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsStatusServiceTest, NoSigninNeeded);
55 FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsStatusServiceTest, DisabledViaPref); 58 FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsStatusServiceTest, DisabledViaPref);
56 59
57 // Callback for the PrefChangeRegistrar. 60 // Callback for the PrefChangeRegistrar.
58 void OnSnippetsEnabledChanged(); 61 void OnSnippetsEnabledChanged();
59 62
60 void OnStateChanged(RemoteSuggestionsStatus new_status); 63 void OnStateChanged(RemoteSuggestionsStatus new_status);
61 64
62 bool IsSignedIn() const; 65 bool IsSignedIn() const;
63 66
64 RemoteSuggestionsStatus GetStatusFromDeps() const; 67 RemoteSuggestionsStatus GetStatusFromDeps() const;
65 68
66 RemoteSuggestionsStatus status_; 69 RemoteSuggestionsStatus status_;
67 StatusChangeCallback status_change_callback_; 70 StatusChangeCallback status_change_callback_;
68 71
69 bool require_signin_; 72 bool require_signin_;
70 SigninManagerBase* signin_manager_; 73 SigninManagerBase* signin_manager_;
71 PrefService* pref_service_; 74 PrefService* pref_service_;
72 75
73 PrefChangeRegistrar pref_change_registrar_; 76 PrefChangeRegistrar pref_change_registrar_;
74 77
75 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsStatusService); 78 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsStatusService);
76 }; 79 };
77 80
78 } // namespace ntp_snippets 81 } // namespace ntp_snippets
79 82
80 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_STATUS_SERVICE_H_ 83 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_STATUS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698