Chromium Code Reviews| Index: chrome/browser/signin/one_click_signin.h |
| =================================================================== |
| --- chrome/browser/signin/one_click_signin.h (revision 0) |
| +++ chrome/browser/signin/one_click_signin.h (revision 0) |
| @@ -0,0 +1,100 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
Andrew T Wilson (Slow)
2012/03/02 19:06:50
I think this stuff should probably live in browser
Roger Tawa OOO till Jul 10th
2012/03/02 22:32:47
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_SIGNIN_ONE_CLICK_SIGNIN_H_ |
| +#define CHROME_BROWSER_SIGNIN_ONE_CLICK_SIGNIN_H_ |
| +#pragma once |
| + |
| +#include <vector> |
| + |
| +#include "chrome/browser/signin/signin_tracker.h" |
| +#include "content/public/browser/web_contents_observer.h" |
| +#include "webkit/forms/password_form.h" |
| +#include "webkit/forms/password_form_dom_manager.h" |
| + |
| +class PrefService; |
| +class Profile; |
| + |
| +namespace content { |
| +class WebContents; |
| +} |
| + |
| +namespace net { |
| +class URLRequest; |
| +} |
| + |
| +// Per-tab one-click signin manager. When a user signs in to a Google service |
| +// and the profile is not yet connected to a Google account, will start the |
| +// process of helping the user connect his profile with one click. The process |
| +// begins with an infobar and is followed with a confirmation dialog explaining |
| +// more about what this means. |
| +class OneClickSigninManager : public content::WebContentsObserver { |
|
Andrew T Wilson (Slow)
2012/03/02 19:06:50
I wonder if we could rename this since it's not ac
Roger Tawa OOO till Jul 10th
2012/03/02 22:32:47
Done.
|
| + public: |
| + // Returns true if the one-click signin feature can be offered at this time. |
| + // It can be offered if the contents is not in an incognito window. |
| + static bool OneClickSigninManager::CanOffer( |
| + content::WebContents* web_contents); |
| + |
| + // Looks for the X-Google-Accounts-SignIn response header, and if found, |
| + // tries to display an infobar in the tab contents identified by the |
| + // child/route id. |
| + static void ShowInfoBarIfPossible(net::URLRequest* request, |
| + int child_id, |
| + int route_id); |
| + |
| + explicit OneClickSigninManager(content::WebContents* web_contents); |
| + ~OneClickSigninManager(); |
| + |
| + private: |
| + // The portion of ShowInfoBarIfPossible() that needs to run on the UI thread. |
| + static void ShowInfoBarUIThread(const std::string& account, |
| + int child_id, |
| + int route_id); |
| + |
| + // content::WebContentsObserver overrides. |
| + virtual void DidNavigateAnyFrame( |
| + const content::LoadCommittedDetails& details, |
| + const content::FrameNavigateParams& params) OVERRIDE; |
| + virtual void DidStopLoading() OVERRIDE; |
| + |
| + // Save the email address that we can display the info bar correctly. |
| + void SaveEmail(const std::string& email); |
| + |
| + // Remember the user's password for later use. |
| + void SavePassword(const webkit::forms::PasswordForm& form); |
| + |
| + // Email address and password of the account that has just logged in. |
| + std::string email_; |
| + std::string password_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(OneClickSigninManager); |
| +}; |
| + |
| +// Waits for successful singin notification from the signin manager and then |
| +// starts the sync machine. Instances of this class delete themselves once |
| +// the job is done. |
| +class OneClickSigninSyncStarter : public SigninTracker::Observer { |
|
Andrew T Wilson (Slow)
2012/03/02 19:06:50
I think it's frowned upon to have two top-level pu
Roger Tawa OOO till Jul 10th
2012/03/02 22:32:47
Done.
|
| + public: |
| + OneClickSigninSyncStarter(const std::string& email, |
| + const std::string& password, |
| + Profile* profile, |
| + bool use_default_settings); |
| + |
| + private: |
| + ~OneClickSigninSyncStarter(); |
| + |
| + // content::SigninTracker::Observer override. |
| + virtual void GaiaCredentialsValid() OVERRIDE; |
| + virtual void SigninFailed() OVERRIDE; |
| + virtual void SigninSuccess() OVERRIDE; |
| + |
| + Profile* profile_; |
| + SigninTracker signin_tracker_; |
| + bool use_default_settings_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); |
| +}; |
| + |
| + |
| +#endif // CHROME_BROWSER_SIGNIN_ONE_CLICK_SIGNIN_H_ |
| Property changes on: chrome\browser\signin\one_click_signin.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |