signin_client.h revision e5d81f57cb97b3b6b7fccc9c5610d21eb81db09d
1// Copyright 2014 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. 4 5#ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ 6#define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ 7 8#include "base/callback.h" 9#include "components/signin/core/browser/webdata/token_web_data.h" 10 11class PrefService; 12class SigninManagerBase; 13class TokenWebData; 14 15namespace net { 16class CanonicalCookie; 17class URLRequestContextGetter; 18} 19 20// An interface that needs to be supplied to the Signin component by its 21// embedder. 22class SigninClient { 23 public: 24 typedef base::Callback<void(const net::CanonicalCookie* cookie)> 25 CookieChangedCallback; 26 27 virtual ~SigninClient() {} 28 29 // Gets the preferences associated with the client. 30 virtual PrefService* GetPrefs() = 0; 31 32 // Gets the TokenWebData instance associated with the client. 33 virtual scoped_refptr<TokenWebData> GetDatabase() = 0; 34 35 // Returns whether it is possible to revoke credentials. 36 virtual bool CanRevokeCredentials() = 0; 37 38 // Returns the URL request context information associated with the client. 39 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; 40 41 // Returns whether the user's credentials should be merged into the cookie 42 // jar on signin completion. 43 virtual bool ShouldMergeSigninCredentialsIntoCookieJar() = 0; 44 45 // Returns a string containing the version info of the product in which the 46 // Signin component is being used. 47 virtual std::string GetProductVersion() = 0; 48 49 // Sets the callback that should be called when a cookie changes. The 50 // callback will be called only if it is not empty. 51 // TODO(blundell): Eliminate this interface in favor of having core signin 52 // code observe cookie changes once //chrome/browser/net has been 53 // componentized. 54 virtual void SetCookieChangedCallback( 55 const CookieChangedCallback& callback) = 0; 56 57 // Called when Google signin has succeeded. 58 virtual void GoogleSigninSucceeded(const std::string& username, 59 const std::string& password) {} 60}; 61 62#endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ 63