Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / sync / sync_error_controller.h
blob8784c3affbade5127fe592743f74a41fee7762a9
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_SYNC_ERROR_CONTROLLER_H_
6 #define CHROME_BROWSER_SYNC_SYNC_ERROR_CONTROLLER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/observer_list.h"
11 #include "chrome/browser/sync/profile_sync_service_observer.h"
13 class Profile;
14 class ProfileSyncService;
16 // Keep track of sync errors and expose them to observers in the UI.
17 class SyncErrorController : public ProfileSyncServiceObserver {
18 public:
19 // The observer class for SyncErrorController lets the controller notify
20 // observers when an error arises or changes.
21 class Observer {
22 public:
23 virtual ~Observer() {}
24 virtual void OnErrorChanged() = 0;
27 explicit SyncErrorController(ProfileSyncService* service);
28 virtual ~SyncErrorController();
30 // True if there exists an error worth elevating to the user.
31 bool HasError();
33 void AddObserver(Observer* observer);
34 void RemoveObserver(Observer* observer);
36 // ProfileSyncServiceObserver:
37 virtual void OnStateChanged() override;
39 private:
40 ProfileSyncService* service_;
41 ObserverList<Observer, true> observer_list_;
43 DISALLOW_COPY_AND_ASSIGN(SyncErrorController);
46 #endif // CHROME_BROWSER_SYNC_SYNC_ERROR_CONTROLLER_H_