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

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 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 // ConfirmInfoBarDelegate:
27 // ConfirmInfoBarDelegate overrides.
28 virtual void InfoBarDismissed() OVERRIDE; 29 virtual void InfoBarDismissed() OVERRIDE;
29 virtual gfx::Image* GetIcon() const OVERRIDE; 30 virtual gfx::Image* GetIcon() const OVERRIDE;
30 virtual Type GetInfoBarType() const OVERRIDE; 31 virtual Type GetInfoBarType() const OVERRIDE;
32 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE;
31 virtual string16 GetMessageText() const OVERRIDE; 33 virtual string16 GetMessageText() const OVERRIDE;
32 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 34 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
33 virtual bool Accept() OVERRIDE; 35 virtual bool Accept() OVERRIDE;
34 virtual bool Cancel() OVERRIDE; 36 virtual bool Cancel() OVERRIDE;
35 37
38 // All the methods below are used by the Android implementation of the
39 // AutoLogin bar on the app side.
40 string16 GetMessageText(const std::string& username) const;
41
42 const std::string& realm() const { return realm_; }
43 const std::string& account() const { return account_; }
44 const std::string& args() const { return args_; }
45
46 private:
36 void RecordHistogramAction(int action); 47 void RecordHistogramAction(int action);
37 48
38 // Username to display in the infobar indicating user to be logged in as. 49 // "realm" string from x-auto-login (e.g. "com.google").
50 std::string realm_;
51
52 // "account" string from x-auto-login.
53 std::string account_;
54
55 // "args" string from x-auto-login to be passed to MergeSession. This string
56 // should be considered opaque and not be cracked open to look inside.
57 std::string args_;
58
59 // Username to display in the infobar indicating user to be logged in as. This
60 // was initially fetched from sync on non-Android platforms.
39 std::string username_; 61 std::string username_;
Roger Tawa OOO till Jul 10th 2012/06/28 14:39:56 why not replace all the members here with a params
Philippe 2012/06/28 15:18:27 I wanted to avoid making AutoLoginInfoBarDelegate
Roger Tawa OOO till Jul 10th 2012/06/28 15:31:51 If you move the declaration of struct Params to he
Philippe 2012/06/28 16:37:34 Indeed.
40 62
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. 63 // Whether any UI controls in the infobar were pressed or not.
46 bool button_pressed_; 64 bool button_pressed_;
47 65
48 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); 66 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate);
49 }; 67 };
50 68
51 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_ 69 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFO_BAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698