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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_AUTO_LOGIN_PROMPTER_H_
6 #define CHROME_BROWSER_UI_AUTO_LOGIN_PROMPTER_H_
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/ui/auto_login_infobar_delegate.h"
12 #include "content/public/browser/web_contents_observer.h"
24 // This class displays an infobar that allows the user to automatically login to
25 // the currently loaded page with one click. This is used when the browser
26 // detects that the user has navigated to a login page and that there are stored
27 // tokens that would allow a one-click login.
28 class AutoLoginPrompter
: public content::WebContentsObserver
{
30 typedef AutoLoginInfoBarDelegate::Params Params
;
32 // Looks for the X-Auto-Login response header in the request, and if found,
33 // tries to display an infobar in the tab contents identified by the
35 static void ShowInfoBarIfPossible(net::URLRequest
* request
,
40 friend class AutoLoginPrompterTest
;
42 AutoLoginPrompter(content::WebContents
* web_contents
,
46 virtual ~AutoLoginPrompter();
48 static void ShowInfoBarUIThread(Params params
,
53 virtual void DidStopLoading(
54 content::RenderViewHost
* render_view_host
) OVERRIDE
;
56 virtual void WebContentsDestroyed(
57 content::WebContents
* web_contents
) OVERRIDE
;
59 // Add the infobar to the WebContents, if it's still needed.
60 void AddInfoBarToWebContents();
66 DISALLOW_COPY_AND_ASSIGN(AutoLoginPrompter
);
69 #endif // CHROME_BROWSER_UI_AUTO_LOGIN_PROMPTER_H_