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

Unified Diff: chrome/common/net/gaia/oauth2_api_call_flow.h

Issue 9982015: Addressing comments from msw and rsleevi for the following patch which is (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « no previous file | chrome/common/net/gaia/oauth2_api_call_flow.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/net/gaia/oauth2_api_call_flow.h
===================================================================
--- chrome/common/net/gaia/oauth2_api_call_flow.h (revision 130661)
+++ chrome/common/net/gaia/oauth2_api_call_flow.h (working copy)
@@ -22,7 +22,7 @@
class URLRequestContextGetter;
}
-// Base calss for all classes that implement a flow to call OAuth2
+// Base class for all classes that implement a flow to call OAuth2
// enabled APIs.
//
// Given a refresh token, an access token, and a list of scopes an OAuth2
@@ -39,8 +39,8 @@
public OAuth2AccessTokenConsumer {
public:
// Creates an instance that works with the given data.
- // Note that access_token can be empty. In that case, the flow will skip
- // the first step (of trying an existing acces token).
+ // Note that |access_token| can be empty. In that case, the flow will skip
+ // the first step (of trying an existing access token).
OAuth2ApiCallFlow(
net::URLRequestContextGetter* context,
const std::string& refresh_token,
@@ -66,7 +66,7 @@
virtual GURL CreateApiCallUrl() = 0;
virtual std::string CreateApiCallBody() = 0;
- // Sub-classes can expose appropriate observer interface by implementing
+ // Sub-classes can expose an appropriate observer interface by implementing
// these template methods.
// Called when the API call finished successfully.
virtual void ProcessApiCallSuccess(const content::URLFetcher* source) = 0;
@@ -78,10 +78,6 @@
const GoogleServiceAuthError& error) = 0;
private:
- // The steps this class performs are:
- // 1. Try existing access token.
- // 2. If that works, flow is done. If not, generate a new access token.
- // 3. Try using new access token.
enum State {
INITIAL,
API_CALL_STARTED,
@@ -93,16 +89,20 @@
friend class OAuth2ApiCallFlowTest;
- // Helper to create an instnace of access token fetcher.
+ // Helper to create an instance of access token fetcher.
// Caller owns the returned instance.
+ // Note that this is virtual since it is mocked during unit testing.
virtual OAuth2AccessTokenFetcher* CreateAccessTokenFetcher();
// Creates an instance of URLFetcher that does not send or save cookies.
+ // Template method CreateApiCallUrl is used to get the URL.
+ // Template method CreateApiCallBody is used to get the body.
// The URLFether's method will be GET if body is empty, POST otherwise.
// Caller owns the returned instance.
+ // Note that this is virtual since it is mocked during unit testing.
virtual content::URLFetcher* CreateURLFetcher();
- // Helper methods to implement the state machien for the flow.
+ // Helper methods to implement the state machine for the flow.
void BeginApiCall();
void EndApiCall(const content::URLFetcher* source);
void BeginMintAccessToken();
@@ -114,7 +114,7 @@
std::vector<std::string> scopes_;
State state_;
- // Whether we have already tried minting access token once.
+ // Whether we have already tried minting an access token once.
bool tried_mint_access_token_;
scoped_ptr<content::URLFetcher> url_fetcher_;
« no previous file with comments | « no previous file | chrome/common/net/gaia/oauth2_api_call_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698