Explicitly add python-numpy dependency to install-build-deps.
[chromium-blink-merge.git] / components / signin / core / browser / profile_oauth2_token_service.cc
blob73c513ed44029c379b101af9fb20655fe06e9da8
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) {}
19 ProfileOAuth2TokenService::~ProfileOAuth2TokenService() {
20 DCHECK(!signin_error_controller_.get()) <<
21 "ProfileOAuth2TokenService::Initialize called but not "
22 "ProfileOAuth2TokenService::Shutdown";
25 void ProfileOAuth2TokenService::Initialize(SigninClient* client) {
26 DCHECK(client);
27 DCHECK(!client_);
28 client_ = client;
30 signin_error_controller_.reset(new SigninErrorController());
33 void ProfileOAuth2TokenService::Shutdown() {
34 DCHECK(client_) << "Shutdown() called without matching call to Initialize()";
35 signin_error_controller_.reset();
38 net::URLRequestContextGetter* ProfileOAuth2TokenService::GetRequestContext() {
39 return NULL;
42 void ProfileOAuth2TokenService::UpdateAuthError(
43 const std::string& account_id,
44 const GoogleServiceAuthError& error) {
45 NOTREACHED();
48 void ProfileOAuth2TokenService::ValidateAccountId(
49 const std::string& account_id) const {
50 DCHECK(!account_id.empty());
52 // If the account is given as an email, make sure its a canonical email.
53 // Note that some tests don't use email strings as account id, and after
54 // the gaia id migration it won't be an email. So only check for
55 // canonicalization if the account_id is suspected to be an email.
56 if (account_id.find('@') != std::string::npos)
57 DCHECK_EQ(gaia::CanonicalizeEmail(account_id), account_id);
60 std::vector<std::string> ProfileOAuth2TokenService::GetAccounts() {
61 NOTREACHED();
62 return std::vector<std::string>();
65 void ProfileOAuth2TokenService::LoadCredentials(
66 const std::string& primary_account_id) {
67 // Empty implementation by default.
70 void ProfileOAuth2TokenService::UpdateCredentials(
71 const std::string& account_id,
72 const std::string& refresh_token) {
73 NOTREACHED();
76 void ProfileOAuth2TokenService::RevokeAllCredentials() {
77 // Empty implementation by default.