| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/content_confirm_infobar_delegate.h" |
| 10 #include "chrome/browser/signin/signin_manager.h" | 10 #include "chrome/browser/signin/signin_manager.h" |
| 11 #include "components/auto_login_parser/auto_login_parser.h" | 11 #include "components/auto_login_parser/auto_login_parser.h" |
| 12 | 12 |
| 13 class PrefService; | 13 class PrefService; |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class NavigationController; | 17 class NavigationController; |
| 18 class WebContents; |
| 18 } | 19 } |
| 19 | 20 |
| 20 // This is the actual infobar displayed to prompt the user to auto-login. | 21 // This is the actual infobar displayed to prompt the user to auto-login. |
| 21 class AutoLoginInfoBarDelegate : public ConfirmInfoBarDelegate, | 22 class AutoLoginInfoBarDelegate : public ContentConfirmInfoBarDelegate, |
| 22 public SigninManagerBase::Observer { | 23 public SigninManagerBase::Observer { |
| 23 public: | 24 public: |
| 24 struct Params { | 25 struct Params { |
| 25 // Information from a parsed header. | 26 // Information from a parsed header. |
| 26 auto_login_parser::HeaderData header; | 27 auto_login_parser::HeaderData header; |
| 27 | 28 |
| 28 // Username to display in the infobar indicating user to be logged in as. | 29 // Username to display in the infobar indicating user to be logged in as. |
| 29 // This is initially fetched from sign-in on non-Android platforms. Note | 30 // This is initially fetched from sign-in on non-Android platforms. Note |
| 30 // that on Android this field is not used. | 31 // that on Android this field is not used. |
| 31 std::string username; | 32 std::string username; |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 // 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 |
| 35 // infobar service for |web_contents|. Returns whether the infobar was | 36 // infobar service for |web_contents|. Returns whether the infobar was |
| 36 // successfully added. | 37 // successfully added. |
| 37 static bool Create(content::WebContents* web_contents, const Params& params); | 38 static bool Create(content::WebContents* web_contents, const Params& params); |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 AutoLoginInfoBarDelegate(const Params& params, Profile* profile); | 41 AutoLoginInfoBarDelegate(content::WebContents* web_contents, |
| 42 const Params& params, |
| 43 Profile* profile); |
| 41 virtual ~AutoLoginInfoBarDelegate(); | 44 virtual ~AutoLoginInfoBarDelegate(); |
| 42 | 45 |
| 43 private: | 46 private: |
| 44 // Enum values used for UMA histograms. | 47 // Enum values used for UMA histograms. |
| 45 enum Actions { | 48 enum Actions { |
| 46 SHOWN, // The infobar was shown to the user. | 49 SHOWN, // The infobar was shown to the user. |
| 47 ACCEPTED, // The user pressed the accept button. | 50 ACCEPTED, // The user pressed the accept button. |
| 48 REJECTED, // The user pressed the reject button. | 51 REJECTED, // The user pressed the reject button. |
| 49 DISMISSED, // The user pressed the close button. | 52 DISMISSED, // The user pressed the close button. |
| 50 IGNORED, // The user ignored the infobar. | 53 IGNORED, // The user ignored the infobar. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 | 74 |
| 72 Profile* profile_; | 75 Profile* profile_; |
| 73 | 76 |
| 74 // Whether any UI controls in the infobar were pressed or not. | 77 // Whether any UI controls in the infobar were pressed or not. |
| 75 bool button_pressed_; | 78 bool button_pressed_; |
| 76 | 79 |
| 77 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); | 80 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ | 83 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_ |
| OLD | NEW |