Remove an unused function from Harfbuzz.
[chromium-blink-merge.git] / google_apis / gaia / oauth2_access_token_fetcher_immediate_error.cc
blobd4bb79dea6a03f0171f24c1a3049f640e4b65309
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 "google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h"
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9 #include "google_apis/gaia/google_service_auth_error.h"
12 OAuth2AccessTokenFetcherImmediateError::FailCaller::FailCaller(
13 OAuth2AccessTokenFetcherImmediateError* fetcher)
14 : fetcher_(fetcher) {
15 base::MessageLoop* looper = base::MessageLoop::current();
16 DCHECK(looper);
17 looper->PostTask(
18 FROM_HERE,
19 base::Bind(&OAuth2AccessTokenFetcherImmediateError::FailCaller::run,
20 this));
23 OAuth2AccessTokenFetcherImmediateError::FailCaller::~FailCaller() {
26 void OAuth2AccessTokenFetcherImmediateError::FailCaller::run() {
27 if (fetcher_) {
28 fetcher_->Fail();
29 fetcher_ = NULL;
33 void OAuth2AccessTokenFetcherImmediateError::FailCaller::detach() {
34 fetcher_ = NULL;
38 OAuth2AccessTokenFetcherImmediateError::OAuth2AccessTokenFetcherImmediateError(
39 OAuth2AccessTokenConsumer* consumer,
40 const GoogleServiceAuthError& error)
41 : OAuth2AccessTokenFetcher(consumer),
42 immediate_error_(error) {
43 DCHECK(immediate_error_ != GoogleServiceAuthError::AuthErrorNone());
46 OAuth2AccessTokenFetcherImmediateError::
47 ~OAuth2AccessTokenFetcherImmediateError() {
48 CancelRequest();
51 void OAuth2AccessTokenFetcherImmediateError::CancelRequest() {
52 if (failer_) {
53 failer_->detach();
54 failer_ = NULL;
58 void OAuth2AccessTokenFetcherImmediateError::Start(
59 const std::string& client_id,
60 const std::string& client_secret,
61 const std::vector<std::string>& scopes) {
62 failer_ = new FailCaller(this);
65 void OAuth2AccessTokenFetcherImmediateError::Fail() {
66 // The call below will likely destruct this object. We have to make a copy
67 // of the error into a local variable because the class member thus will
68 // be destroyed after which the copy-passed-by-reference will cause a
69 // memory violation when accessed.
70 GoogleServiceAuthError error_copy = immediate_error_;
71 FireOnGetTokenFailure(error_copy);