OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_SERVICE_H_ |
6 #define CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_SERVICE_H_ | 6 #define CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // Requests an asynchronous refresh from the network. After the update | 36 // Requests an asynchronous refresh from the network. After the update |
37 // completes, the observers will be notified only if something changed. | 37 // completes, the observers will be notified only if something changed. |
38 void Refresh(); | 38 void Refresh(); |
39 | 39 |
40 // Add/remove observers. All observers must unregister themselves before the | 40 // Add/remove observers. All observers must unregister themselves before the |
41 // OneGoogleBarService is destroyed. | 41 // OneGoogleBarService is destroyed. |
42 void AddObserver(OneGoogleBarServiceObserver* observer); | 42 void AddObserver(OneGoogleBarServiceObserver* observer); |
43 void RemoveObserver(OneGoogleBarServiceObserver* observer); | 43 void RemoveObserver(OneGoogleBarServiceObserver* observer); |
44 | 44 |
| 45 OneGoogleBarFetcher* fetcher_for_testing() { return fetcher_.get(); } |
| 46 |
45 private: | 47 private: |
46 class SigninObserver; | 48 class SigninObserver; |
47 | 49 |
48 void SigninStatusChanged(); | 50 void SigninStatusChanged(); |
49 | 51 |
| 52 void OneGoogleBarDataFetched(const base::Optional<OneGoogleBarData>& data); |
| 53 |
50 void SetOneGoogleBarData(const base::Optional<OneGoogleBarData>& data); | 54 void SetOneGoogleBarData(const base::Optional<OneGoogleBarData>& data); |
51 | 55 |
52 std::unique_ptr<OneGoogleBarFetcher> fetcher_; | 56 std::unique_ptr<OneGoogleBarFetcher> fetcher_; |
53 | 57 |
54 std::unique_ptr<SigninObserver> signin_observer_; | 58 std::unique_ptr<SigninObserver> signin_observer_; |
55 | 59 |
56 base::ObserverList<OneGoogleBarServiceObserver, true> observers_; | 60 base::ObserverList<OneGoogleBarServiceObserver, true> observers_; |
57 | 61 |
58 base::Optional<OneGoogleBarData> one_google_bar_data_; | 62 base::Optional<OneGoogleBarData> one_google_bar_data_; |
59 }; | 63 }; |
60 | 64 |
61 #endif // CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_SERVICE_H_ | 65 #endif // CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_SERVICE_H_ |
OLD | NEW |