OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_SIGNIN_CORE_BROWSER_SIGNIN_ERROR_CONTROLLER_H_ | 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_ERROR_CONTROLLER_H_ |
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_ERROR_CONTROLLER_H_ | 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_ERROR_CONTROLLER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "google_apis/gaia/google_service_auth_error.h" | 12 #include "google_apis/gaia/google_service_auth_error.h" |
13 | 13 |
| 14 class SigninClient; |
| 15 |
14 // Keep track of auth errors and expose them to observers in the UI. Services | 16 // Keep track of auth errors and expose them to observers in the UI. Services |
15 // that wish to expose auth errors to the user should register an | 17 // that wish to expose auth errors to the user should register an |
16 // AuthStatusProvider to report their current authentication state, and should | 18 // AuthStatusProvider to report their current authentication state, and should |
17 // invoke AuthStatusChanged() when their authentication state may have changed. | 19 // invoke AuthStatusChanged() when their authentication state may have changed. |
18 class SigninErrorController { | 20 class SigninErrorController { |
19 public: | 21 public: |
20 class AuthStatusProvider { | 22 class AuthStatusProvider { |
21 public: | 23 public: |
22 AuthStatusProvider(); | 24 AuthStatusProvider(); |
23 virtual ~AuthStatusProvider(); | 25 virtual ~AuthStatusProvider(); |
(...skipping 10 matching lines...) Expand all Loading... |
34 }; | 36 }; |
35 | 37 |
36 // The observer class for SigninErrorController lets the controller notify | 38 // The observer class for SigninErrorController lets the controller notify |
37 // observers when an error arises or changes. | 39 // observers when an error arises or changes. |
38 class Observer { | 40 class Observer { |
39 public: | 41 public: |
40 virtual ~Observer() {} | 42 virtual ~Observer() {} |
41 virtual void OnErrorChanged() = 0; | 43 virtual void OnErrorChanged() = 0; |
42 }; | 44 }; |
43 | 45 |
44 SigninErrorController(); | 46 SigninErrorController(SigninClient* signin_client); |
45 ~SigninErrorController(); | 47 ~SigninErrorController(); |
46 | 48 |
47 // Adds a provider which the SigninErrorController object will start querying | 49 // Adds a provider which the SigninErrorController object will start querying |
48 // for auth status. | 50 // for auth status. |
49 void AddProvider(const AuthStatusProvider* provider); | 51 void AddProvider(const AuthStatusProvider* provider); |
50 | 52 |
51 // Removes a provider previously added by SigninErrorController (generally | 53 // Removes a provider previously added by SigninErrorController (generally |
52 // only called in preparation for shutdown). | 54 // only called in preparation for shutdown). |
53 void RemoveProvider(const AuthStatusProvider* provider); | 55 void RemoveProvider(const AuthStatusProvider* provider); |
54 | 56 |
(...skipping 20 matching lines...) Expand all Loading... |
75 // The auth error detected the last time AuthStatusChanged() was invoked (or | 77 // The auth error detected the last time AuthStatusChanged() was invoked (or |
76 // NONE if AuthStatusChanged() has never been invoked). | 78 // NONE if AuthStatusChanged() has never been invoked). |
77 GoogleServiceAuthError auth_error_; | 79 GoogleServiceAuthError auth_error_; |
78 | 80 |
79 ObserverList<Observer, false> observer_list_; | 81 ObserverList<Observer, false> observer_list_; |
80 | 82 |
81 DISALLOW_COPY_AND_ASSIGN(SigninErrorController); | 83 DISALLOW_COPY_AND_ASSIGN(SigninErrorController); |
82 }; | 84 }; |
83 | 85 |
84 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_ERROR_CONTROLLER_H_ | 86 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_ERROR_CONTROLLER_H_ |
OLD | NEW |