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

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

Issue 10690006: Upstream changes needed by Android auto-login. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Peter's comments Created 8 years, 5 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/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 struct Params {
22 const std::string& username, 22 Params();
23 const std::string& args); 23 ~Params();
24
25 // "realm" string from x-auto-login (e.g. "com.google").
26 std::string realm;
27
28 // "account" string from x-auto-login.
29 std::string account;
30
31 // "args" string from x-auto-login to be passed to MergeSession. This string
32 // should be considered opaque and not be cracked open to look inside.
33 std::string args;
34
35 // Username to display in the infobar indicating user to be logged in as.
36 // This is initially fetched from sign-in on non-Android platforms. Note
37 // that on Android this field is not used.
38 std::string username;
39 };
40
41 AutoLoginInfoBarDelegate(InfoBarTabHelper* owner, const Params& params);
24 virtual ~AutoLoginInfoBarDelegate(); 42 virtual ~AutoLoginInfoBarDelegate();
25 43
26 private: 44 // ConfirmInfoBarDelegate:
27 // ConfirmInfoBarDelegate overrides.
28 virtual void InfoBarDismissed() OVERRIDE; 45 virtual void InfoBarDismissed() OVERRIDE;
29 virtual gfx::Image* GetIcon() const OVERRIDE; 46 virtual gfx::Image* GetIcon() const OVERRIDE;
30 virtual Type GetInfoBarType() const OVERRIDE; 47 virtual Type GetInfoBarType() const OVERRIDE;
48 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE;
31 virtual string16 GetMessageText() const OVERRIDE; 49 virtual string16 GetMessageText() const OVERRIDE;
32 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 50 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
33 virtual bool Accept() OVERRIDE; 51 virtual bool Accept() OVERRIDE;
34 virtual bool Cancel() OVERRIDE; 52 virtual bool Cancel() OVERRIDE;
35 53
54 // All the methods below are used by the Android implementation of the
55 // AutoLogin bar on the app side.
56 string16 GetMessageText(const std::string& username) const;
57
58 const std::string& realm() const { return params_.realm; }
59 const std::string& account() const { return params_.account; }
60 const std::string& args() const { return params_.args; }
61
62 private:
36 void RecordHistogramAction(int action); 63 void RecordHistogramAction(int action);
37 64
38 // Username to display in the infobar indicating user to be logged in as. 65 const Params params_;
39 std::string username_;
40
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 66
45 // Whether any UI controls in the infobar were pressed or not. 67 // Whether any UI controls in the infobar were pressed or not.
46 bool button_pressed_; 68 bool button_pressed_;
47 69
48 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); 70 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate);
49 }; 71 };
50 72
51 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_ 73 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobar_delegate.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