| Index: chrome/common/net/gaia/oauth2_mint_token_flow.cc
|
| diff --git a/chrome/common/net/gaia/oauth2_mint_token_flow.cc b/chrome/common/net/gaia/oauth2_mint_token_flow.cc
|
| index b5c9e518d68721cb7cb716f7786e43568e32a943..66c13d0e2b90dcd6733904f1cdb9af73d35a45bb 100644
|
| --- a/chrome/common/net/gaia/oauth2_mint_token_flow.cc
|
| +++ b/chrome/common/net/gaia/oauth2_mint_token_flow.cc
|
| @@ -114,6 +114,8 @@ OAuth2MintTokenFlow::OAuth2MintTokenFlow(
|
| OAuth2MintTokenFlow::~OAuth2MintTokenFlow() { }
|
|
|
| void OAuth2MintTokenFlow::Start() {
|
| + AddRef(); // Balanced in ReportSuccess|IssueAdviceSuccess|Failure.
|
| +
|
| if (g_interceptor_for_tests) {
|
| std::string auth_token;
|
| GoogleServiceAuthError error = GoogleServiceAuthError::None();
|
| @@ -124,17 +126,16 @@ void OAuth2MintTokenFlow::Start() {
|
| if (g_interceptor_for_tests->DoIntercept(this, &auth_token, &error)) {
|
| MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(&OAuth2MintTokenFlow::Delegate::OnMintTokenSuccess,
|
| - base::Unretained(delegate_), auth_token));
|
| + base::Bind(&OAuth2MintTokenFlow::ReportSuccess, this, auth_token));
|
| } else {
|
| MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(&OAuth2MintTokenFlow::Delegate::OnMintTokenFailure,
|
| - base::Unretained(delegate_), error));
|
| + base::Bind(&OAuth2MintTokenFlow::ReportFailure, this, error));
|
| }
|
| return;
|
| }
|
|
|
| +
|
| OAuth2ApiCallFlow::Start();
|
| }
|
|
|
| @@ -142,12 +143,17 @@ void OAuth2MintTokenFlow::ReportSuccess(const std::string& access_token) {
|
| if (delegate_) {
|
| delegate_->OnMintTokenSuccess(access_token);
|
| }
|
| +
|
| + Release(); // Balanced in Start().
|
| }
|
|
|
| -void OAuth2MintTokenFlow::ReportSuccess(const IssueAdviceInfo& issue_advice) {
|
| +void OAuth2MintTokenFlow::ReportIssueAdviceSuccess(
|
| + const IssueAdviceInfo& issue_advice) {
|
| if (delegate_) {
|
| delegate_->OnIssueAdviceSuccess(issue_advice);
|
| }
|
| +
|
| + Release(); // Balanced in Start().
|
| }
|
|
|
| void OAuth2MintTokenFlow::ReportFailure(
|
| @@ -155,6 +161,8 @@ void OAuth2MintTokenFlow::ReportFailure(
|
| if (delegate_) {
|
| delegate_->OnMintTokenFailure(error);
|
| }
|
| +
|
| + Release(); // Balanced in Start().
|
| }
|
|
|
| GURL OAuth2MintTokenFlow::CreateApiCallUrl() {
|
| @@ -201,7 +209,7 @@ void OAuth2MintTokenFlow::ProcessApiCallSuccess(
|
| if (issue_advice == kIssueAdviceValueConsent) {
|
| IssueAdviceInfo issue_advice;
|
| if (ParseIssueAdviceResponse(dict, &issue_advice))
|
| - ReportSuccess(issue_advice);
|
| + ReportIssueAdviceSuccess(issue_advice);
|
| else
|
| ReportFailure(GoogleServiceAuthError::FromConnectionError(101));
|
| } else {
|
|
|