Chromium Code Reviews| 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_INFO_BAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 8 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 9 | 9 |
| 10 class InfoBarTabHelper; | 10 class InfoBarTabHelper; |
| 11 class PrefService; | 11 class PrefService; |
| 12 class TokenService; | 12 class TokenService; |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class NavigationController; | 15 class NavigationController; |
| 16 } // namespace content | 16 } // namespace content |
| 17 | 17 |
| 18 // This is the actual infobar displayed to prompt the user to auto-login. | 18 // This is the actual infobar displayed to prompt the user to auto-login. |
| 19 class AutoLoginInfoBarDelegate : public ConfirmInfoBarDelegate { | 19 class AutoLoginInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 20 public: | 20 public: |
| 21 AutoLoginInfoBarDelegate(InfoBarTabHelper* owner, | 21 AutoLoginInfoBarDelegate(InfoBarTabHelper* owner, |
| 22 const std::string& username, | 22 const std::string& realm, |
| 23 const std::string& args); | 23 const std::string& account, |
| 24 const std::string& args, | |
| 25 const std::string& username); | |
| 24 virtual ~AutoLoginInfoBarDelegate(); | 26 virtual ~AutoLoginInfoBarDelegate(); |
| 25 | 27 |
| 26 private: | 28 // InfoBarDelegate: |
| 27 // ConfirmInfoBarDelegate overrides. | 29 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE; |
| 30 | |
| 31 // ConfirmInfoBarDelegate: | |
| 28 virtual void InfoBarDismissed() OVERRIDE; | 32 virtual void InfoBarDismissed() OVERRIDE; |
| 29 virtual gfx::Image* GetIcon() const OVERRIDE; | 33 virtual gfx::Image* GetIcon() const OVERRIDE; |
| 30 virtual Type GetInfoBarType() const OVERRIDE; | 34 virtual Type GetInfoBarType() const OVERRIDE; |
| 31 virtual string16 GetMessageText() const OVERRIDE; | 35 virtual string16 GetMessageText() const OVERRIDE; |
| 32 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 36 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 33 virtual bool Accept() OVERRIDE; | 37 virtual bool Accept() OVERRIDE; |
| 34 virtual bool Cancel() OVERRIDE; | 38 virtual bool Cancel() OVERRIDE; |
| 35 | 39 |
| 40 string16 GetMessageText(const string16& username) const; | |
| 41 | |
| 42 const std::string& realm() const { | |
| 43 return realm_; | |
| 44 } | |
| 45 | |
| 46 const std::string& account() const { | |
| 47 return account_; | |
| 48 } | |
| 49 | |
| 50 const std::string& args() const { | |
| 51 return args_; | |
| 52 } | |
| 53 | |
| 54 private: | |
| 36 void RecordHistogramAction(int action); | 55 void RecordHistogramAction(int action); |
| 37 | 56 |
| 38 // Username to display in the infobar indicating user to be logged in as. | 57 // "realm" string from x-auto-login (e.g. "com.google"). |
| 58 std::string realm_; | |
| 59 | |
| 60 // "account" string from x-auto-login. | |
| 61 std::string account_; | |
| 62 | |
| 63 // "args" string from x-auto-login to be passed to MergeSession. This string | |
| 64 // should be considered opaque and not be cracked open to look inside. | |
| 65 std::string args_; | |
| 66 | |
| 67 // Username to display in the infobar indicating user to be logged in as. This | |
| 68 // was initially fetched from sync on non-Android platforms. | |
| 39 std::string username_; | 69 std::string username_; |
|
Nico
2012/06/27 15:14:33
Nit: This probably isn't always ascii. In that cas
Philippe
2012/06/27 16:52:02
Indeed it seems possible to have non-ASCII charact
Nico
2012/06/27 16:54:51
That's fine (if it works, adding a test would be n
| |
| 40 | 70 |
| 41 // "args" string from x-auto-login to be passed to MergeSession. This | |
| 42 // string should be considered opaque and not be cracked open to look inside. | |
| 43 std::string args_; | |
| 44 | |
| 45 // Whether any UI controls in the infobar were pressed or not. | 71 // Whether any UI controls in the infobar were pressed or not. |
| 46 bool button_pressed_; | 72 bool button_pressed_; |
| 47 | 73 |
| 48 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); |
| 49 }; | 75 }; |
| 50 | 76 |
| 51 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_ | 77 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_ |
| OLD | NEW |