#ifndef CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_
#define CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/signin/core/browser/signin_client.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/render_process_host_observer.h"
class CookieSettings;
class Profile;
class ChromeSigninClient : public SigninClient,
public KeyedService,
public content::NotificationObserver,
public content::RenderProcessHostObserver {
public:
explicit ChromeSigninClient(Profile* profile);
virtual ~ChromeSigninClient();
static bool ProfileAllowsSigninCookies(Profile* profile);
static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings);
void SetSigninProcess(int host_id);
void ClearSigninProcess();
bool IsSigninProcess(int host_id) const;
bool HasSigninProcess() const;
virtual void RenderProcessHostDestroyed(content::RenderProcessHost* host)
OVERRIDE;
virtual PrefService* GetPrefs() OVERRIDE;
virtual scoped_refptr<TokenWebData> GetDatabase() OVERRIDE;
virtual bool CanRevokeCredentials() OVERRIDE;
virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE;
virtual bool ShouldMergeSigninCredentialsIntoCookieJar() OVERRIDE;
virtual std::string GetProductVersion() OVERRIDE;
virtual void SetCookieChangedCallback(const CookieChangedCallback& callback)
OVERRIDE;
virtual void GoogleSigninSucceeded(const std::string& username,
const std::string& password) OVERRIDE;
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
private:
void RegisterForCookieChangedNotification();
void UnregisterForCookieChangedNotification();
Profile* profile_;
content::NotificationRegistrar registrar_;
CookieChangedCallback callback_;
int signin_host_id_;
std::set<content::RenderProcessHost*> signin_hosts_observed_;
DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient);
};
#endif