OLD | NEW |
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_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 const GoogleServiceAuthError& error) override; | 221 const GoogleServiceAuthError& error) override; |
222 | 222 |
223 // Starts a mint token request to GAIA. | 223 // Starts a mint token request to GAIA. |
224 // Exposed for testing. | 224 // Exposed for testing. |
225 virtual void StartGaiaRequest(const std::string& login_access_token); | 225 virtual void StartGaiaRequest(const std::string& login_access_token); |
226 | 226 |
227 // Caller owns the returned instance. | 227 // Caller owns the returned instance. |
228 // Exposed for testing. | 228 // Exposed for testing. |
229 virtual OAuth2MintTokenFlow* CreateMintTokenFlow(); | 229 virtual OAuth2MintTokenFlow* CreateMintTokenFlow(); |
230 | 230 |
231 scoped_ptr<OAuth2TokenService::Request> login_token_request_; | 231 std::unique_ptr<OAuth2TokenService::Request> login_token_request_; |
232 | 232 |
233 private: | 233 private: |
234 FRIEND_TEST_ALL_PREFIXES(GetAuthTokenFunctionTest, | 234 FRIEND_TEST_ALL_PREFIXES(GetAuthTokenFunctionTest, |
235 ComponentWithChromeClientId); | 235 ComponentWithChromeClientId); |
236 FRIEND_TEST_ALL_PREFIXES(GetAuthTokenFunctionTest, | 236 FRIEND_TEST_ALL_PREFIXES(GetAuthTokenFunctionTest, |
237 ComponentWithNormalClientId); | 237 ComponentWithNormalClientId); |
238 FRIEND_TEST_ALL_PREFIXES(GetAuthTokenFunctionTest, InteractiveQueueShutdown); | 238 FRIEND_TEST_ALL_PREFIXES(GetAuthTokenFunctionTest, InteractiveQueueShutdown); |
239 FRIEND_TEST_ALL_PREFIXES(GetAuthTokenFunctionTest, NoninteractiveShutdown); | 239 FRIEND_TEST_ALL_PREFIXES(GetAuthTokenFunctionTest, NoninteractiveShutdown); |
240 | 240 |
241 // ExtensionFunction: | 241 // ExtensionFunction: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 283 |
284 // Maps OAuth2 protocol errors to an error message returned to the | 284 // Maps OAuth2 protocol errors to an error message returned to the |
285 // developer in chrome.runtime.lastError. | 285 // developer in chrome.runtime.lastError. |
286 std::string MapOAuth2ErrorToDescription(const std::string& error); | 286 std::string MapOAuth2ErrorToDescription(const std::string& error); |
287 | 287 |
288 std::string GetOAuth2ClientId() const; | 288 std::string GetOAuth2ClientId() const; |
289 | 289 |
290 bool interactive_; | 290 bool interactive_; |
291 bool should_prompt_for_scopes_; | 291 bool should_prompt_for_scopes_; |
292 IdentityMintRequestQueue::MintType mint_token_flow_type_; | 292 IdentityMintRequestQueue::MintType mint_token_flow_type_; |
293 scoped_ptr<OAuth2MintTokenFlow> mint_token_flow_; | 293 std::unique_ptr<OAuth2MintTokenFlow> mint_token_flow_; |
294 OAuth2MintTokenFlow::Mode gaia_mint_token_mode_; | 294 OAuth2MintTokenFlow::Mode gaia_mint_token_mode_; |
295 bool should_prompt_for_signin_; | 295 bool should_prompt_for_signin_; |
296 | 296 |
297 scoped_ptr<ExtensionTokenKey> token_key_; | 297 std::unique_ptr<ExtensionTokenKey> token_key_; |
298 std::string oauth2_client_id_; | 298 std::string oauth2_client_id_; |
299 // When launched in interactive mode, and if there is no existing grant, | 299 // When launched in interactive mode, and if there is no existing grant, |
300 // a permissions prompt will be popped up to the user. | 300 // a permissions prompt will be popped up to the user. |
301 IssueAdviceInfo issue_advice_; | 301 IssueAdviceInfo issue_advice_; |
302 scoped_ptr<GaiaWebAuthFlow> gaia_web_auth_flow_; | 302 std::unique_ptr<GaiaWebAuthFlow> gaia_web_auth_flow_; |
303 scoped_ptr<IdentitySigninFlow> signin_flow_; | 303 std::unique_ptr<IdentitySigninFlow> signin_flow_; |
304 }; | 304 }; |
305 | 305 |
306 class IdentityGetProfileUserInfoFunction | 306 class IdentityGetProfileUserInfoFunction |
307 : public ChromeUIThreadExtensionFunction { | 307 : public ChromeUIThreadExtensionFunction { |
308 public: | 308 public: |
309 DECLARE_EXTENSION_FUNCTION("identity.getProfileUserInfo", | 309 DECLARE_EXTENSION_FUNCTION("identity.getProfileUserInfo", |
310 IDENTITY_GETPROFILEUSERINFO); | 310 IDENTITY_GETPROFILEUSERINFO); |
311 | 311 |
312 IdentityGetProfileUserInfoFunction(); | 312 IdentityGetProfileUserInfoFunction(); |
313 | 313 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 bool RunAsync() override; | 348 bool RunAsync() override; |
349 | 349 |
350 // WebAuthFlow::Delegate implementation. | 350 // WebAuthFlow::Delegate implementation. |
351 void OnAuthFlowFailure(WebAuthFlow::Failure failure) override; | 351 void OnAuthFlowFailure(WebAuthFlow::Failure failure) override; |
352 void OnAuthFlowURLChange(const GURL& redirect_url) override; | 352 void OnAuthFlowURLChange(const GURL& redirect_url) override; |
353 void OnAuthFlowTitleChange(const std::string& title) override {} | 353 void OnAuthFlowTitleChange(const std::string& title) override {} |
354 | 354 |
355 // Helper to initialize final URL prefix. | 355 // Helper to initialize final URL prefix. |
356 void InitFinalRedirectURLPrefix(const std::string& extension_id); | 356 void InitFinalRedirectURLPrefix(const std::string& extension_id); |
357 | 357 |
358 scoped_ptr<WebAuthFlow> auth_flow_; | 358 std::unique_ptr<WebAuthFlow> auth_flow_; |
359 GURL final_url_prefix_; | 359 GURL final_url_prefix_; |
360 }; | 360 }; |
361 | 361 |
362 } // namespace extensions | 362 } // namespace extensions |
363 | 363 |
364 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ | 364 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ |
OLD | NEW |