Chromium Code Reviews| 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 void RecordHistogramAction(Actions action); | |
|
Peter Kasting
2014/04/28 21:28:33
Nit: Blank line above this
Ted C
2014/04/28 21:29:57
Done.
| |
| 55 | |
| 56 private: | |
| 56 // ConfirmInfoBarDelegate: | 57 // ConfirmInfoBarDelegate: |
| 57 virtual void InfoBarDismissed() OVERRIDE; | 58 virtual void InfoBarDismissed() OVERRIDE; |
| 58 virtual int GetIconID() const OVERRIDE; | 59 virtual int GetIconID() const OVERRIDE; |
| 59 virtual Type GetInfoBarType() const OVERRIDE; | 60 virtual Type GetInfoBarType() const OVERRIDE; |
| 60 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE; | 61 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE; |
| 61 virtual base::string16 GetMessageText() const OVERRIDE; | 62 virtual base::string16 GetMessageText() const OVERRIDE; |
| 62 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 63 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 63 virtual bool Accept() OVERRIDE; | 64 virtual bool Accept() OVERRIDE; |
| 64 virtual bool Cancel() OVERRIDE; | 65 virtual bool Cancel() OVERRIDE; |
| 65 | 66 |
| 66 // SigninManagerBase::Observer: | 67 // SigninManagerBase::Observer: |
| 67 virtual void GoogleSignedOut(const std::string& username) OVERRIDE; | 68 virtual void GoogleSignedOut(const std::string& username) OVERRIDE; |
| 68 | 69 |
| 69 void RecordHistogramAction(Actions action); | |
| 70 | |
| 71 const Params params_; | 70 const Params params_; |
| 72 | 71 |
| 73 Profile* profile_; | 72 Profile* profile_; |
| 74 | 73 |
| 75 // Whether any UI controls in the infobar were pressed or not. | 74 // Whether any UI controls in the infobar were pressed or not. |
| 76 bool button_pressed_; | 75 bool button_pressed_; |
| 77 | 76 |
| 78 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); | 77 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ | 80 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ |
| OLD | NEW |