signin_client.h revision a02191e04bc25c4935f804f2c080ae28663d096d
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#if defined(OS_IOS) 21namespace ios { 22// TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from the 23// core SigninClient. 24class ProfileOAuth2TokenServiceIOSProvider; 25} 26#endif 27 28// An interface that needs to be supplied to the Signin component by its 29// embedder. 30class SigninClient { 31 public: 32 typedef base::Callback<void(const net::CanonicalCookie* cookie)> 33 CookieChangedCallback; 34 35 virtual ~SigninClient() {} 36 37 // Gets the preferences associated with the client. 38 virtual PrefService* GetPrefs() = 0; 39 40 // Gets the TokenWebData instance associated with the client. 41 virtual scoped_refptr<TokenWebData> GetDatabase() = 0; 42 43 // Returns whether it is possible to revoke credentials. 44 virtual bool CanRevokeCredentials() = 0; 45 46 // Returns the URL request context information associated with the client. 47 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; 48 49 // Returns whether the user's credentials should be merged into the cookie 50 // jar on signin completion. 51 virtual bool ShouldMergeSigninCredentialsIntoCookieJar() = 0; 52 53 // Returns a string containing the version info of the product in which the 54 // Signin component is being used. 55 virtual std::string GetProductVersion() = 0; 56 57 // Sets the callback that should be called when a cookie changes. The 58 // callback will be called only if it is not empty. 59 // TODO(blundell): Eliminate this interface in favor of having core signin 60 // code observe cookie changes once //chrome/browser/net has been 61 // componentized. 62 virtual void SetCookieChangedCallback( 63 const CookieChangedCallback& callback) = 0; 64 65 // Called when Google signin has succeeded. 66 virtual void GoogleSigninSucceeded(const std::string& username, 67 const std::string& password) {} 68 69#if defined(OS_IOS) 70 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from 71 // the core SigninClient. 72 virtual ios::ProfileOAuth2TokenServiceIOSProvider* GetIOSProvider() = 0; 73#endif 74}; 75 76#endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ 77