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/api/infobars/confirm_infobar_delegate.h" | 8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
9 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
10 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // "args" string from x-auto-login to be passed to MergeSession. This string | 33 // "args" string from x-auto-login to be passed to MergeSession. This string |
34 // should be considered opaque and not be cracked open to look inside. | 34 // should be considered opaque and not be cracked open to look inside. |
35 std::string args; | 35 std::string args; |
36 | 36 |
37 // Username to display in the infobar indicating user to be logged in as. | 37 // Username to display in the infobar indicating user to be logged in as. |
38 // This is initially fetched from sign-in on non-Android platforms. Note | 38 // This is initially fetched from sign-in on non-Android platforms. Note |
39 // that on Android this field is not used. | 39 // that on Android this field is not used. |
40 std::string username; | 40 std::string username; |
41 }; | 41 }; |
42 | 42 |
43 AutoLoginInfoBarDelegate(InfoBarService* owner, const Params& params); | 43 // Creates an autologin delegate and adds it to |infobar_service|. |
44 virtual ~AutoLoginInfoBarDelegate(); | 44 static void Create(InfoBarService* infobar_service, const Params& params); |
45 | 45 |
46 // ConfirmInfoBarDelegate: | 46 // ConfirmInfoBarDelegate: |
47 virtual void InfoBarDismissed() OVERRIDE; | 47 virtual void InfoBarDismissed() OVERRIDE; |
48 virtual gfx::Image* GetIcon() const OVERRIDE; | 48 virtual gfx::Image* GetIcon() const OVERRIDE; |
49 virtual Type GetInfoBarType() const OVERRIDE; | 49 virtual Type GetInfoBarType() const OVERRIDE; |
50 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE; | 50 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE; |
51 virtual string16 GetMessageText() const OVERRIDE; | 51 virtual string16 GetMessageText() const OVERRIDE; |
52 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 52 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
53 virtual bool Accept() OVERRIDE; | 53 virtual bool Accept() OVERRIDE; |
54 virtual bool Cancel() OVERRIDE; | 54 virtual bool Cancel() OVERRIDE; |
55 | 55 |
56 // content::NotificationObserver overrides. | 56 // content::NotificationObserver overrides. |
57 virtual void Observe(int type, | 57 virtual void Observe(int type, |
58 const content::NotificationSource& source, | 58 const content::NotificationSource& source, |
59 const content::NotificationDetails& details) OVERRIDE; | 59 const content::NotificationDetails& details) OVERRIDE; |
60 | 60 |
61 // All the methods below are used by the Android implementation of the | 61 // All the methods below are used by the Android implementation of the |
62 // AutoLogin bar on the app side. | 62 // AutoLogin bar on the app side. |
63 string16 GetMessageText(const std::string& username) const; | 63 string16 GetMessageText(const std::string& username) const; |
64 | 64 |
65 const std::string& realm() const { return params_.realm; } | 65 const std::string& realm() const { return params_.realm; } |
66 const std::string& account() const { return params_.account; } | 66 const std::string& account() const { return params_.account; } |
67 const std::string& args() const { return params_.args; } | 67 const std::string& args() const { return params_.args; } |
68 | 68 |
69 private: | 69 private: |
| 70 AutoLoginInfoBarDelegate(InfoBarService* owner, const Params& params); |
| 71 virtual ~AutoLoginInfoBarDelegate(); |
| 72 |
70 void RecordHistogramAction(int action); | 73 void RecordHistogramAction(int action); |
71 | 74 |
72 const Params params_; | 75 const Params params_; |
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 // For listening to the user signing out. | 80 // For listening to the user signing out. |
78 content::NotificationRegistrar registrar_; | 81 content::NotificationRegistrar registrar_; |
79 | 82 |
80 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); | 83 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); |
81 }; | 84 }; |
82 | 85 |
83 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_ | 86 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_ |
OLD | NEW |