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

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

Issue 208393015: Revert "Remove desktop auto-login since we don't plan on shipping it there. Refactor the base and … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
OLDNEW
1 // Copyright 2014 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_ANDROID_INFOBARS_AUTO_LOGIN_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_UI_ANDROID_INFOBARS_AUTO_LOGIN_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/android/jni_helper.h"
10 #include "base/android/scoped_java_ref.h"
11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
12 #include "chrome/browser/signin/signin_manager.h" 10 #include "chrome/browser/signin/signin_manager.h"
13 #include "components/auto_login_parser/auto_login_parser.h" 11 #include "components/auto_login_parser/auto_login_parser.h"
14 12
15 class PrefService; 13 class PrefService;
16 class Profile; 14 class Profile;
17 15
18 namespace content { 16 namespace content {
19 class NavigationController; 17 class NavigationController;
20 } 18 }
(...skipping 10 matching lines...) Expand all
31 // This is initially fetched from sign-in on non-Android platforms. Note 29 // This is initially fetched from sign-in on non-Android platforms. Note
32 // that on Android this field is not used. 30 // that on Android this field is not used.
33 std::string username; 31 std::string username;
34 }; 32 };
35 33
36 // Creates an autologin infobar and delegate and adds the infobar to the 34 // Creates an autologin infobar and delegate and adds the infobar to the
37 // infobar service for |web_contents|. Returns whether the infobar was 35 // infobar service for |web_contents|. Returns whether the infobar was
38 // successfully added. 36 // successfully added.
39 static bool Create(content::WebContents* web_contents, const Params& params); 37 static bool Create(content::WebContents* web_contents, const Params& params);
40 38
41 // These methods are defined in downstream code.
42 bool AttachAccount(JavaObjectWeakGlobalRef weak_java_translate_helper);
43 void LoginSuccess(JNIEnv* env, jobject obj, jstring result);
44 void LoginFailed(JNIEnv* env, jobject obj);
45 void LoginDismiss(JNIEnv* env, jobject obj);
46
47 // Register Android JNI bindings.
48 static bool Register(JNIEnv* env);
49
50 protected: 39 protected:
51 AutoLoginInfoBarDelegate(const Params& params, Profile* profile); 40 AutoLoginInfoBarDelegate(const Params& params, Profile* profile);
52 virtual ~AutoLoginInfoBarDelegate(); 41 virtual ~AutoLoginInfoBarDelegate();
53 42
54 private: 43 private:
55 // Enum values used for UMA histograms. 44 // Enum values used for UMA histograms.
56 enum Actions { 45 enum Actions {
57 SHOWN, // The infobar was shown to the user. 46 SHOWN, // The infobar was shown to the user.
58 ACCEPTED, // The user pressed the accept button. 47 ACCEPTED, // The user pressed the accept button.
59 REJECTED, // The user pressed the reject button. 48 REJECTED, // The user pressed the reject button.
60 DISMISSED, // The user pressed the close button. 49 DISMISSED, // The user pressed the close button.
61 IGNORED, // The user ignored the infobar. 50 IGNORED, // The user ignored the infobar.
62 LEARN_MORE, // The user clicked on the learn more link. 51 LEARN_MORE, // The user clicked on the learn more link.
63 HISTOGRAM_BOUNDING_VALUE 52 HISTOGRAM_BOUNDING_VALUE
64 }; 53 };
65 54
66 const std::string& realm() const { return params_.header.realm; }
67 const std::string& account() const { return params_.header.account; }
68 const std::string& args() const { return params_.header.args; }
69
70 // ConfirmInfoBarDelegate: 55 // ConfirmInfoBarDelegate:
71 virtual void InfoBarDismissed() OVERRIDE; 56 virtual void InfoBarDismissed() OVERRIDE;
72 virtual int GetIconID() const OVERRIDE; 57 virtual int GetIconID() const OVERRIDE;
73 virtual Type GetInfoBarType() const OVERRIDE; 58 virtual Type GetInfoBarType() const OVERRIDE;
74 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE; 59 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE;
75 virtual base::string16 GetMessageText() const OVERRIDE; 60 virtual base::string16 GetMessageText() const OVERRIDE;
76 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 61 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
77 virtual bool Accept() OVERRIDE; 62 virtual bool Accept() OVERRIDE;
78 virtual bool Cancel() OVERRIDE; 63 virtual bool Cancel() OVERRIDE;
79 64
80 // SigninManagerBase::Observer: 65 // SigninManagerBase::Observer:
81 virtual void GoogleSignedOut(const std::string& username) OVERRIDE; 66 virtual void GoogleSignedOut(const std::string& username) OVERRIDE;
82 67
83 void RecordHistogramAction(Actions action); 68 void RecordHistogramAction(Actions action);
84 69
85 JavaObjectWeakGlobalRef weak_java_auto_login_delegate_;
86 std::string user_;
87 const Params params_; 70 const Params params_;
88 71
89 Profile* profile_; 72 Profile* profile_;
90 73
91 // Whether any UI controls in the infobar were pressed or not. 74 // Whether any UI controls in the infobar were pressed or not.
92 bool button_pressed_; 75 bool button_pressed_;
93 76
94 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate); 77 DISALLOW_COPY_AND_ASSIGN(AutoLoginInfoBarDelegate);
95 }; 78 };
96 79
97 #endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_AUTO_LOGIN_INFOBAR_DELEGATE_H_ 80 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_INFOBAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/infobars/infobar_container_android.cc ('k') | chrome/browser/ui/auto_login_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698