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.
5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_
8 #include "base/callback.h"
9 #include "components/signin/core/browser/webdata/token_web_data.h"
12 class SigninManagerBase;
16 class CanonicalCookie;
17 class URLRequestContextGetter;
22 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from the
24 class ProfileOAuth2TokenServiceIOSProvider;
28 // An interface that needs to be supplied to the Signin component by its
32 typedef base::Callback<void(const net::CanonicalCookie* cookie)>
33 CookieChangedCallback;
35 virtual ~SigninClient() {}
37 // Gets the preferences associated with the client.
38 virtual PrefService* GetPrefs() = 0;
40 // Gets the TokenWebData instance associated with the client.
41 virtual scoped_refptr<TokenWebData> GetDatabase() = 0;
43 // Returns whether it is possible to revoke credentials.
44 virtual bool CanRevokeCredentials() = 0;
46 // Returns the URL request context information associated with the client.
47 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0;
49 // Returns whether the user's credentials should be merged into the cookie
50 // jar on signin completion.
51 virtual bool ShouldMergeSigninCredentialsIntoCookieJar() = 0;
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;
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
62 virtual void SetCookieChangedCallback(
63 const CookieChangedCallback& callback) = 0;
65 // Called when Google signin has succeeded.
66 virtual void GoogleSigninSucceeded(const std::string& username,
67 const std::string& password) {}
70 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from
71 // the core SigninClient.
72 virtual ios::ProfileOAuth2TokenServiceIOSProvider* GetIOSProvider() = 0;
76 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_