Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2176)

Unified Diff: chrome/common/net/gaia/oauth2_mint_token_flow.cc

Issue 10630021: Modify experimental identity flow to display scope descriptions and details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 {

Powered by Google App Engine
This is Rietveld 408576698