| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_SIGNIN_SIGNIN_GLOBAL_ERROR_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_ | 6 #define CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_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 "chrome/browser/ui/global_error/global_error.h" | 11 #include "chrome/browser/ui/global_error/global_error.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 Profile; | 14 class Profile; |
| 15 class SigninManager; | 15 class SigninManagerBase; |
| 16 | 16 |
| 17 // Shows auth errors on the wrench menu using a bubble view and a | 17 // Shows auth errors on the wrench menu using a bubble view and a |
| 18 // menu item. Services that wish to expose auth errors to the user should | 18 // menu item. Services that wish to expose auth errors to the user should |
| 19 // register an AuthStatusProvider to report their current authentication state, | 19 // register an AuthStatusProvider to report their current authentication state, |
| 20 // and should invoke AuthStatusChanged() when their authentication state may | 20 // and should invoke AuthStatusChanged() when their authentication state may |
| 21 // have changed. | 21 // have changed. |
| 22 class SigninGlobalError : public GlobalError { | 22 class SigninGlobalError : public GlobalError { |
| 23 public: | 23 public: |
| 24 class AuthStatusProvider { | 24 class AuthStatusProvider { |
| 25 public: | 25 public: |
| 26 AuthStatusProvider(); | 26 AuthStatusProvider(); |
| 27 virtual ~AuthStatusProvider(); | 27 virtual ~AuthStatusProvider(); |
| 28 | 28 |
| 29 // API invoked by SigninGlobalError to get the current auth status of | 29 // API invoked by SigninGlobalError to get the current auth status of |
| 30 // the various signed in services. | 30 // the various signed in services. |
| 31 virtual GoogleServiceAuthError GetAuthStatus() const = 0; | 31 virtual GoogleServiceAuthError GetAuthStatus() const = 0; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 SigninGlobalError(SigninManager* signin_manager, Profile* profile); | 34 SigninGlobalError(SigninManagerBase* signin_manager, Profile* profile); |
| 35 virtual ~SigninGlobalError(); | 35 virtual ~SigninGlobalError(); |
| 36 | 36 |
| 37 // Adds a provider which the SigninGlobalError object will start querying for | 37 // Adds a provider which the SigninGlobalError object will start querying for |
| 38 // auth status. | 38 // auth status. |
| 39 void AddProvider(const AuthStatusProvider* provider); | 39 void AddProvider(const AuthStatusProvider* provider); |
| 40 | 40 |
| 41 // Removes a provider previously added by SigninGlobalError (generally only | 41 // Removes a provider previously added by SigninGlobalError (generally only |
| 42 // called in preparation for shutdown). | 42 // called in preparation for shutdown). |
| 43 void RemoveProvider(const AuthStatusProvider* provider); | 43 void RemoveProvider(const AuthStatusProvider* provider); |
| 44 | 44 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 63 virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE; | 63 virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 std::set<const AuthStatusProvider*> provider_set_; | 66 std::set<const AuthStatusProvider*> provider_set_; |
| 67 | 67 |
| 68 // The auth error detected the last time AuthStatusChanged() was invoked (or | 68 // The auth error detected the last time AuthStatusChanged() was invoked (or |
| 69 // NONE if AuthStatusChanged() has never been invoked). | 69 // NONE if AuthStatusChanged() has never been invoked). |
| 70 GoogleServiceAuthError auth_error_; | 70 GoogleServiceAuthError auth_error_; |
| 71 | 71 |
| 72 // The SigninManager that owns this object. | 72 // The SigninManager that owns this object. |
| 73 SigninManager* signin_manager_; | 73 SigninManagerBase* signin_manager_; |
| 74 | 74 |
| 75 // The Profile this object belongs to. | 75 // The Profile this object belongs to. |
| 76 Profile* profile_; | 76 Profile* profile_; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_ | 79 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_ |
| OLD | NEW |