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.
4
5#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_AUTH_SYNC_OBSERVER_H_
6#define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_AUTH_SYNC_OBSERVER_H_
7
8#include <string>
9
10#include "base/basictypes.h"
11#include "base/compiler_specific.h"
12#include "chrome/browser/sync/profile_sync_service_observer.h"
13#include "components/keyed_service/core/keyed_service.h"
14
15class Profile;
16
17namespace chromeos {
18
19// This class is responsible for detecting authentication problems reported
20// by sync service and
21class AuthSyncObserver : public KeyedService,
22                         public ProfileSyncServiceObserver {
23 public:
24  explicit AuthSyncObserver(Profile* user_profile);
25  virtual ~AuthSyncObserver();
26
27  void StartObserving();
28
29 private:
30  friend class AuthSyncObserverFactory;
31
32  // KeyedService implementation.
33  virtual void Shutdown() OVERRIDE;
34
35  // ProfileSyncServiceObserver implementation.
36  virtual void OnStateChanged() OVERRIDE;
37
38  // Called on attempt to restore supervised user token.
39  void OnSupervisedTokenLoaded(const std::string& token);
40
41  Profile* profile_;
42
43  DISALLOW_COPY_AND_ASSIGN(AuthSyncObserver);
44};
45
46}  // namespace chromeos
47
48#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_AUTH_SYNC_OBSERVER_H_
49