Add abhijeet.k@samsung.com to AUTHORS list.
[chromium-blink-merge.git] / components / signin / core / browser / profile_oauth2_token_service.cc
blob0de1e2b6ded4e1848305cf2f9531007fce7b408d
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 #include "components/signin/core/browser/profile_oauth2_token_service.h"
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h"
10 #include "base/time/time.h"
11 #include "components/signin/core/browser/signin_client.h"
12 #include "components/signin/core/browser/signin_error_controller.h"
13 #include "google_apis/gaia/gaia_auth_util.h"
14 #include "net/url_request/url_request_context_getter.h"
16 ProfileOAuth2TokenService::ProfileOAuth2TokenService()
17 : client_(NULL),
18 signin_error_controller_(NULL) {}
20 ProfileOAuth2TokenService::~ProfileOAuth2TokenService() {}
22 void ProfileOAuth2TokenService::Initialize(
23 SigninClient* client,
24 SigninErrorController* signin_error_controller) {
25 DCHECK(client);
26 DCHECK(!client_);
27 DCHECK(signin_error_controller);
28 DCHECK(!signin_error_controller_);
29 client_ = client;
30 signin_error_controller_ = signin_error_controller;
33 void ProfileOAuth2TokenService::Shutdown() {
34 DCHECK(client_) << "Shutdown() called without matching call to Initialize()";
37 net::URLRequestContextGetter* ProfileOAuth2TokenService::GetRequestContext() {
38 return NULL;
41 void ProfileOAuth2TokenService::UpdateAuthError(
42 const std::string& account_id,
43 const GoogleServiceAuthError& error) {
44 NOTREACHED();
47 void ProfileOAuth2TokenService::ValidateAccountId(
48 const std::string& account_id) const {
49 DCHECK(!account_id.empty());
51 // If the account is given as an email, make sure its a canonical email.
52 // Note that some tests don't use email strings as account id, and after
53 // the gaia id migration it won't be an email. So only check for
54 // canonicalization if the account_id is suspected to be an email.
55 if (account_id.find('@') != std::string::npos)
56 DCHECK_EQ(gaia::CanonicalizeEmail(account_id), account_id);
59 std::vector<std::string> ProfileOAuth2TokenService::GetAccounts() {
60 NOTREACHED();
61 return std::vector<std::string>();
64 void ProfileOAuth2TokenService::LoadCredentials(
65 const std::string& primary_account_id) {
66 // Empty implementation by default.
69 void ProfileOAuth2TokenService::UpdateCredentials(
70 const std::string& account_id,
71 const std::string& refresh_token) {
72 NOTREACHED();
75 void ProfileOAuth2TokenService::RevokeAllCredentials() {
76 // Empty implementation by default.