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 CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
10 #include "components/auto_login_parser/auto_login_parser.h" | 10 #include "components/auto_login_parser/auto_login_parser.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // that on Android this field is not used. | 31 // that on Android this field is not used. |
32 std::string username; | 32 std::string username; |
33 }; | 33 }; |
34 | 34 |
35 // Creates an autologin infobar and delegate and adds the infobar to the | 35 // Creates an autologin infobar and delegate and adds the infobar to the |
36 // infobar service for |web_contents|. Returns whether the infobar was | 36 // infobar service for |web_contents|. Returns whether the infobar was |
37 // successfully added. | 37 // successfully added. |
38 static bool Create(content::WebContents* web_contents, const Params& params); | 38 static bool Create(content::WebContents* web_contents, const Params& params); |
39 | 39 |
40 protected: | 40 protected: |
41 AutoLoginInfoBarDelegate(const Params& params, Profile* profile); | |
42 virtual ~AutoLoginInfoBarDelegate(); | |
43 | |
44 private: | |
45 // Enum values used for UMA histograms. | 41 // Enum values used for UMA histograms. |
46 enum Actions { | 42 enum Actions { |
47 SHOWN, // The infobar was shown to the user. | 43 SHOWN, // The infobar was shown to the user. |
48 ACCEPTED, // The user pressed the accept button. | 44 ACCEPTED, // The user pressed the accept button. |
49 REJECTED, // The user pressed the reject button. | 45 REJECTED, // The user pressed the reject button. |
50 DISMISSED, // The user pressed the close button. | 46 DISMISSED, // The user pressed the close button. |
51 IGNORED, // The user ignored the infobar. | 47 IGNORED, // The user ignored the infobar. |
52 LEARN_MORE, // The user clicked on the learn more link. | 48 LEARN_MORE, // The user clicked on the learn more link. |
53 HISTOGRAM_BOUNDING_VALUE | 49 HISTOGRAM_BOUNDING_VALUE |
54 }; | 50 }; |
55 | 51 |
| 52 AutoLoginInfoBarDelegate(const Params& params, Profile* profile); |
| 53 virtual ~AutoLoginInfoBarDelegate(); |
| 54 |
| 55 void RecordHistogramAction(Actions action); |
| 56 |
| 57 private: |
56 // ConfirmInfoBarDelegate: | 58 // ConfirmInfoBarDelegate: |
57 virtual void InfoBarDismissed() OVERRIDE; | 59 virtual void InfoBarDismissed() OVERRIDE; |
58 virtual int GetIconID() const OVERRIDE; | 60 virtual int GetIconID() const OVERRIDE; |
59 virtual Type GetInfoBarType() const OVERRIDE; | 61 virtual Type GetInfoBarType() const OVERRIDE; |
60 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE; | 62 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE; |
61 virtual base::string16 GetMessageText() const OVERRIDE; | 63 virtual base::string16 GetMessageText() const OVERRIDE; |
62 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 64 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
63 virtual bool Accept() OVERRIDE; | 65 virtual bool Accept() OVERRIDE; |
64 virtual bool Cancel() OVERRIDE; | 66 virtual bool Cancel() OVERRIDE; |
65 | 67 |
66 // SigninManagerBase::Observer: | 68 // SigninManagerBase::Observer: |
67 virtual void GoogleSignedOut(const std::string& username) OVERRIDE; | 69 virtual void GoogleSignedOut(const std::string& username) OVERRIDE; |
68 | 70 |
69 void RecordHistogramAction(Actions action); | |
70 | |
71 const Params params_; | 71 const Params params_; |
72 | 72 |
73 Profile* profile_; | 73 Profile* profile_; |
74 | 74 |
75 // Whether any UI controls in the infobar were pressed or not. | 75 // Whether any UI controls in the infobar were pressed or not. |
76 bool button_pressed_; | 76 bool button_pressed_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); |
79 }; | 79 }; |
80 | 80 |
81 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ | 81 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ |
OLD | NEW |