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

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

Issue 10702017: Revert r 144574 "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, 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"
12 #include "chrome/common/net/gaia/oauth2_api_call_flow.h" 11 #include "chrome/common/net/gaia/oauth2_api_call_flow.h"
13 12
14 class GoogleServiceAuthError; 13 class GoogleServiceAuthError;
15 class OAuth2MintTokenFlowTest; 14 class OAuth2MintTokenFlowTest;
16 15
17 namespace base { 16 namespace base {
18 class DictionaryValue; 17 class DictionaryValue;
19 } 18 }
20 19
21 namespace content { 20 namespace content {
22 class URLFetcher; 21 class URLFetcher;
23 } 22 }
24 23
25 namespace net { 24 namespace net {
26 class URLRequestContextGetter; 25 class URLRequestContextGetter;
27 } 26 }
28 27
29 // IssueAdvice: messages to show to the user to get a user's approval. 28 // IssueAdvice: messages to show to the user to get a user's approval.
30 // The structure is as follows: 29 // The structure is as follows:
31 // * Description 1 30 // * Descritpion 1
32 // - Detail 1.1 31 // - Detail 1.1
33 // - Details 1.2 32 // - Details 1.2
34 // * Description 2 33 // * Description 2
35 // - Detail 2.1 34 // - Detail 2.1
36 // - Detail 2.2 35 // - Detail 2.2
37 // - Detail 2.3 36 // - Detail 2.3
38 // * Description 3 37 // * Description 3
39 // - Detail 3.1 38 // - Detail 3.1
40 struct IssueAdviceInfoEntry { 39 struct IssueAdviceInfoEntry {
41 public: 40 public:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 }; 107 };
109 static void SetInterceptorForTests(InterceptorForTests* interceptor); 108 static void SetInterceptorForTests(InterceptorForTests* interceptor);
110 109
111 OAuth2MintTokenFlow(net::URLRequestContextGetter* context, 110 OAuth2MintTokenFlow(net::URLRequestContextGetter* context,
112 Delegate* delegate, 111 Delegate* delegate,
113 const Parameters& parameters); 112 const Parameters& parameters);
114 virtual ~OAuth2MintTokenFlow(); 113 virtual ~OAuth2MintTokenFlow();
115 114
116 virtual void Start() OVERRIDE; 115 virtual void Start() OVERRIDE;
117 116
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
122 protected: 117 protected:
123 // Implementation of template methods in OAuth2ApiCallFlow. 118 // Implementation of template methods in OAuth2ApiCallFlow.
124 virtual GURL CreateApiCallUrl() OVERRIDE; 119 virtual GURL CreateApiCallUrl() OVERRIDE;
125 virtual std::string CreateApiCallBody() OVERRIDE; 120 virtual std::string CreateApiCallBody() OVERRIDE;
126 121
127 virtual void ProcessApiCallSuccess( 122 virtual void ProcessApiCallSuccess(
128 const net::URLFetcher* source) OVERRIDE; 123 const net::URLFetcher* source) OVERRIDE;
129 virtual void ProcessApiCallFailure( 124 virtual void ProcessApiCallFailure(
130 const net::URLFetcher* source) OVERRIDE; 125 const net::URLFetcher* source) OVERRIDE;
131 virtual void ProcessNewAccessToken(const std::string& access_token) OVERRIDE; 126 virtual void ProcessNewAccessToken(const std::string& access_token) OVERRIDE;
132 virtual void ProcessMintAccessTokenFailure( 127 virtual void ProcessMintAccessTokenFailure(
133 const GoogleServiceAuthError& error) OVERRIDE; 128 const GoogleServiceAuthError& error) OVERRIDE;
134 129
135 private: 130 private:
136 friend class OAuth2MintTokenFlowTest; 131 friend class OAuth2MintTokenFlowTest;
137 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, CreateApiCallBody); 132 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, CreateApiCallBody);
138 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseIssueAdviceResponse); 133 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseIssueAdviceResponse);
139 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseMintTokenResponse); 134 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseMintTokenResponse);
140 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallSuccess); 135 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallSuccess);
141 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallFailure); 136 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallFailure);
142 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, 137 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest,
143 ProcessMintAccessTokenFailure); 138 ProcessMintAccessTokenFailure);
144 139
145 void ReportSuccess(const std::string& access_token); 140 void ReportSuccess(const std::string& access_token);
146 void ReportIssueAdviceSuccess(const IssueAdviceInfo& issue_advice); 141 void ReportSuccess(const IssueAdviceInfo& issue_advice);
147 void ReportFailure(const GoogleServiceAuthError& error); 142 void ReportFailure(const GoogleServiceAuthError& error);
148 143
149 static bool ParseIssueAdviceResponse( 144 static bool ParseIssueAdviceResponse(
150 const base::DictionaryValue* dict, IssueAdviceInfo* issue_advice); 145 const base::DictionaryValue* dict, IssueAdviceInfo* issue_advice);
151 static bool ParseMintTokenResponse( 146 static bool ParseMintTokenResponse(
152 const base::DictionaryValue* dict, std::string* access_token); 147 const base::DictionaryValue* dict, std::string* access_token);
153 148
154 net::URLRequestContextGetter* context_; 149 net::URLRequestContextGetter* context_;
155 Delegate* delegate_; 150 Delegate* delegate_;
156 Parameters parameters_; 151 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_;
161 152
162 DISALLOW_COPY_AND_ASSIGN(OAuth2MintTokenFlow); 153 DISALLOW_COPY_AND_ASSIGN(OAuth2MintTokenFlow);
163 }; 154 };
164 155
165 #endif // CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ 156 #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