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

Side by Side Diff: chrome/common/net/gaia/oauth2_mint_token_flow.h

Issue 10630021: Modify experimental identity flow to display scope descriptions and details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ 5 #ifndef CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_
6 #define CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ 6 #define CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/weak_ptr.h"
11 #include "chrome/common/net/gaia/oauth2_api_call_flow.h" 12 #include "chrome/common/net/gaia/oauth2_api_call_flow.h"
12 13
13 class GoogleServiceAuthError; 14 class GoogleServiceAuthError;
14 class OAuth2MintTokenFlowTest; 15 class OAuth2MintTokenFlowTest;
15 16
16 namespace base { 17 namespace base {
17 class DictionaryValue; 18 class DictionaryValue;
18 } 19 }
19 20
20 namespace content { 21 namespace content {
21 class URLFetcher; 22 class URLFetcher;
22 } 23 }
23 24
24 namespace net { 25 namespace net {
25 class URLRequestContextGetter; 26 class URLRequestContextGetter;
26 } 27 }
27 28
28 // IssueAdvice: messages to show to the user to get a user's approval. 29 // IssueAdvice: messages to show to the user to get a user's approval.
29 // The structure is as follows: 30 // The structure is as follows:
30 // * Descritpion 1 31 // * Description 1
31 // - Detail 1.1 32 // - Detail 1.1
32 // - Details 1.2 33 // - Details 1.2
33 // * Description 2 34 // * Description 2
34 // - Detail 2.1 35 // - Detail 2.1
35 // - Detail 2.2 36 // - Detail 2.2
36 // - Detail 2.3 37 // - Detail 2.3
37 // * Description 3 38 // * Description 3
38 // - Detail 3.1 39 // - Detail 3.1
39 struct IssueAdviceInfoEntry { 40 struct IssueAdviceInfoEntry {
40 public: 41 public:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 }; 108 };
108 static void SetInterceptorForTests(InterceptorForTests* interceptor); 109 static void SetInterceptorForTests(InterceptorForTests* interceptor);
109 110
110 OAuth2MintTokenFlow(net::URLRequestContextGetter* context, 111 OAuth2MintTokenFlow(net::URLRequestContextGetter* context,
111 Delegate* delegate, 112 Delegate* delegate,
112 const Parameters& parameters); 113 const Parameters& parameters);
113 virtual ~OAuth2MintTokenFlow(); 114 virtual ~OAuth2MintTokenFlow();
114 115
115 virtual void Start() OVERRIDE; 116 virtual void Start() OVERRIDE;
116 117
118 // Starts the flow, and deletes |this| when done. Useful when the caller
119 // does not care about the response (|delegate_| is NULL).
120 void FireAndForget();
121
117 protected: 122 protected:
118 // Implementation of template methods in OAuth2ApiCallFlow. 123 // Implementation of template methods in OAuth2ApiCallFlow.
119 virtual GURL CreateApiCallUrl() OVERRIDE; 124 virtual GURL CreateApiCallUrl() OVERRIDE;
120 virtual std::string CreateApiCallBody() OVERRIDE; 125 virtual std::string CreateApiCallBody() OVERRIDE;
121 126
122 virtual void ProcessApiCallSuccess( 127 virtual void ProcessApiCallSuccess(
123 const net::URLFetcher* source) OVERRIDE; 128 const net::URLFetcher* source) OVERRIDE;
124 virtual void ProcessApiCallFailure( 129 virtual void ProcessApiCallFailure(
125 const net::URLFetcher* source) OVERRIDE; 130 const net::URLFetcher* source) OVERRIDE;
126 virtual void ProcessNewAccessToken(const std::string& access_token) OVERRIDE; 131 virtual void ProcessNewAccessToken(const std::string& access_token) OVERRIDE;
127 virtual void ProcessMintAccessTokenFailure( 132 virtual void ProcessMintAccessTokenFailure(
128 const GoogleServiceAuthError& error) OVERRIDE; 133 const GoogleServiceAuthError& error) OVERRIDE;
129 134
130 private: 135 private:
131 friend class OAuth2MintTokenFlowTest; 136 friend class OAuth2MintTokenFlowTest;
132 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, CreateApiCallBody); 137 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, CreateApiCallBody);
133 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseIssueAdviceResponse); 138 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseIssueAdviceResponse);
134 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseMintTokenResponse); 139 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseMintTokenResponse);
135 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallSuccess); 140 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallSuccess);
136 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallFailure); 141 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallFailure);
137 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, 142 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest,
138 ProcessMintAccessTokenFailure); 143 ProcessMintAccessTokenFailure);
139 144
140 void ReportSuccess(const std::string& access_token); 145 void ReportSuccess(const std::string& access_token);
141 void ReportSuccess(const IssueAdviceInfo& issue_advice); 146 void ReportIssueAdviceSuccess(const IssueAdviceInfo& issue_advice);
142 void ReportFailure(const GoogleServiceAuthError& error); 147 void ReportFailure(const GoogleServiceAuthError& error);
143 148
144 static bool ParseIssueAdviceResponse( 149 static bool ParseIssueAdviceResponse(
145 const base::DictionaryValue* dict, IssueAdviceInfo* issue_advice); 150 const base::DictionaryValue* dict, IssueAdviceInfo* issue_advice);
146 static bool ParseMintTokenResponse( 151 static bool ParseMintTokenResponse(
147 const base::DictionaryValue* dict, std::string* access_token); 152 const base::DictionaryValue* dict, std::string* access_token);
148 153
149 net::URLRequestContextGetter* context_; 154 net::URLRequestContextGetter* context_;
150 Delegate* delegate_; 155 Delegate* delegate_;
151 Parameters parameters_; 156 Parameters parameters_;
157 // If true, |this| owns itself and will delete itself after reporting
158 // success or failure.
159 bool delete_when_done_;
160 base::WeakPtrFactory<OAuth2MintTokenFlow> weak_factory_;
152 161
153 DISALLOW_COPY_AND_ASSIGN(OAuth2MintTokenFlow); 162 DISALLOW_COPY_AND_ASSIGN(OAuth2MintTokenFlow);
154 }; 163 };
155 164
156 #endif // CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ 165 #endif // CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/permission_set.h ('k') | chrome/common/net/gaia/oauth2_mint_token_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698