Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: chrome/browser/ui/auto_login_info_bar_delegate.h

Issue 11644059: Change infobar creation to use a public static Create() method on the infobar delegate classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_manager.cc ('k') | chrome/browser/ui/auto_login_info_bar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698