| 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 "base/gtest_prod_util.h" |
| 11 #include "chrome/browser/ui/global_error/global_error.h" | 12 #include "chrome/browser/ui/global_error/global_error.h" |
| 12 #include "components/keyed_service/core/keyed_service.h" | 13 #include "components/keyed_service/core/keyed_service.h" |
| 13 #include "components/signin/core/browser/signin_error_controller.h" | 14 #include "components/signin/core/browser/signin_error_controller.h" |
| 14 | 15 |
| 15 class Profile; | 16 class Profile; |
| 16 | 17 |
| 17 // Shows auth errors on the wrench menu using a bubble view and a menu item. | 18 // Shows auth errors on the wrench menu using a bubble view and a menu item. |
| 18 class SigninGlobalError : public GlobalErrorWithStandardBubble, | 19 class SigninGlobalError : public GlobalErrorWithStandardBubble, |
| 19 public SigninErrorController::Observer, | 20 public SigninErrorController::Observer, |
| 20 public KeyedService { | 21 public KeyedService { |
| 21 public: | 22 public: |
| 22 SigninGlobalError(SigninErrorController* error_controller, | 23 SigninGlobalError(SigninErrorController* error_controller, |
| 23 Profile* profile); | 24 Profile* profile); |
| 24 virtual ~SigninGlobalError(); | 25 virtual ~SigninGlobalError(); |
| 25 | 26 |
| 27 // Returns true if there is an authentication error. |
| 28 bool HasError(); |
| 29 |
| 30 // Shows re-authentication UI to the user in an attempt to fix the error. |
| 31 // The re-authentication UI will be shown in |browser|. |
| 32 void AttemptToFixError(Browser* browser); |
| 33 |
| 34 private: |
| 35 FRIEND_TEST_ALL_PREFIXES(SigninGlobalErrorTest, NoErrorAuthStatusProviders); |
| 36 FRIEND_TEST_ALL_PREFIXES(SigninGlobalErrorTest, ErrorAuthStatusProvider); |
| 37 FRIEND_TEST_ALL_PREFIXES(SigninGlobalErrorTest, AuthStatusEnumerateAllErrors); |
| 38 |
| 26 // KeyedService: | 39 // KeyedService: |
| 27 virtual void Shutdown() OVERRIDE; | 40 virtual void Shutdown() OVERRIDE; |
| 28 | 41 |
| 29 // GlobalErrorWithStandardBubble: | 42 // GlobalErrorWithStandardBubble: |
| 30 virtual bool HasMenuItem() OVERRIDE; | 43 virtual bool HasMenuItem() OVERRIDE; |
| 31 virtual int MenuItemCommandID() OVERRIDE; | 44 virtual int MenuItemCommandID() OVERRIDE; |
| 32 virtual base::string16 MenuItemLabel() OVERRIDE; | 45 virtual base::string16 MenuItemLabel() OVERRIDE; |
| 33 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; | 46 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; |
| 34 virtual bool HasBubbleView() OVERRIDE; | 47 virtual bool HasBubbleView() OVERRIDE; |
| 35 virtual base::string16 GetBubbleViewTitle() OVERRIDE; | 48 virtual base::string16 GetBubbleViewTitle() OVERRIDE; |
| 36 virtual std::vector<base::string16> GetBubbleViewMessages() OVERRIDE; | 49 virtual std::vector<base::string16> GetBubbleViewMessages() OVERRIDE; |
| 37 virtual base::string16 GetBubbleViewAcceptButtonLabel() OVERRIDE; | 50 virtual base::string16 GetBubbleViewAcceptButtonLabel() OVERRIDE; |
| 38 virtual base::string16 GetBubbleViewCancelButtonLabel() OVERRIDE; | 51 virtual base::string16 GetBubbleViewCancelButtonLabel() OVERRIDE; |
| 39 virtual void OnBubbleViewDidClose(Browser* browser) OVERRIDE; | 52 virtual void OnBubbleViewDidClose(Browser* browser) OVERRIDE; |
| 40 virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE; | 53 virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE; |
| 41 virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE; | 54 virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE; |
| 42 | 55 |
| 43 // SigninErrorController::Observer: | 56 // SigninErrorController::Observer: |
| 44 virtual void OnErrorChanged() OVERRIDE; | 57 virtual void OnErrorChanged() OVERRIDE; |
| 45 | 58 |
| 46 private: | |
| 47 // The Profile this service belongs to. | 59 // The Profile this service belongs to. |
| 48 Profile* profile_; | 60 Profile* profile_; |
| 49 | 61 |
| 50 // The SigninErrorController that provides auth status. | 62 // The SigninErrorController that provides auth status. |
| 51 SigninErrorController* error_controller_; | 63 SigninErrorController* error_controller_; |
| 52 | 64 |
| 53 DISALLOW_COPY_AND_ASSIGN(SigninGlobalError); | 65 DISALLOW_COPY_AND_ASSIGN(SigninGlobalError); |
| 54 }; | 66 }; |
| 55 | 67 |
| 56 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_ | 68 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_ |
| OLD | NEW |