Support SizeClassIdiom on iOS7.
[chromium-blink-merge.git] / chrome / browser / signin / signin_global_error.h
blob86846c80437885952ed3449185e4b724959ef9f3
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_
6 #define CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_
8 #include <set>
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "chrome/browser/ui/global_error/global_error.h"
13 #include "components/keyed_service/core/keyed_service.h"
14 #include "components/signin/core/browser/signin_error_controller.h"
16 class Profile;
18 // Shows auth errors on the wrench menu using a bubble view and a menu item.
19 class SigninGlobalError : public GlobalErrorWithStandardBubble,
20 public SigninErrorController::Observer,
21 public KeyedService {
22 public:
23 SigninGlobalError(SigninErrorController* error_controller,
24 Profile* profile);
25 ~SigninGlobalError() override;
27 // Returns true if there is an authentication error.
28 bool HasError();
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);
34 private:
35 FRIEND_TEST_ALL_PREFIXES(SigninGlobalErrorTest, NoErrorAuthStatusProviders);
36 FRIEND_TEST_ALL_PREFIXES(SigninGlobalErrorTest, ErrorAuthStatusProvider);
37 FRIEND_TEST_ALL_PREFIXES(SigninGlobalErrorTest, AuthStatusEnumerateAllErrors);
39 // KeyedService:
40 void Shutdown() override;
42 // GlobalErrorWithStandardBubble:
43 bool HasMenuItem() override;
44 int MenuItemCommandID() override;
45 base::string16 MenuItemLabel() override;
46 void ExecuteMenuItem(Browser* browser) override;
47 bool HasBubbleView() override;
48 base::string16 GetBubbleViewTitle() override;
49 std::vector<base::string16> GetBubbleViewMessages() override;
50 base::string16 GetBubbleViewAcceptButtonLabel() override;
51 base::string16 GetBubbleViewCancelButtonLabel() override;
52 void OnBubbleViewDidClose(Browser* browser) override;
53 void BubbleViewAcceptButtonPressed(Browser* browser) override;
54 void BubbleViewCancelButtonPressed(Browser* browser) override;
56 // SigninErrorController::Observer:
57 void OnErrorChanged() override;
59 // The Profile this service belongs to.
60 Profile* profile_;
62 // The SigninErrorController that provides auth status.
63 SigninErrorController* error_controller_;
65 // True if signin global error was added to the global error service.
66 bool is_added_to_global_error_service_;
68 DISALLOW_COPY_AND_ASSIGN(SigninGlobalError);
71 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_