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

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

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

Powered by Google App Engine
This is Rietveld 408576698