Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_ | 5 #ifndef SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_ |
| 6 #define SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_ | 6 #define SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_ |
| 7 | 7 |
| 8 #include "mojo/public/cpp/bindings/binding.h" | 8 #include "mojo/public/cpp/bindings/binding.h" |
| 9 #include "mojo/public/cpp/bindings/error_handler.h" | 9 #include "mojo/public/cpp/bindings/error_handler.h" |
| 10 #include "mojo/services/authenticating_url_loader/public/interfaces/authenticati ng_url_loader.mojom.h" | 10 #include "mojo/services/authenticating_url_loader/public/interfaces/authenticati ng_url_loader.mojom.h" |
| 11 #include "mojo/services/authentication/public/interfaces/authentication.mojom.h" | 11 #include "mojo/services/authentication/public/interfaces/authentication.mojom.h" |
| 12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 13 #include "url/gurl.h" | |
| 13 | 14 |
| 14 namespace mojo { | 15 namespace mojo { |
| 15 | 16 |
| 16 class NetworkService; | 17 class NetworkService; |
| 17 | 18 |
| 18 enum RequestAuthorizationState { | 19 enum RequestAuthorizationState { |
| 19 REQUEST_NOT_AUTHORIZED, | 20 REQUEST_NOT_AUTHORIZED, |
|
blundell
2015/05/27 15:43:44
These names are misleading now.
How about
REQUES
qsr
2015/05/27 16:02:26
Done.
| |
| 20 REQUEST_AUTHORIZED_WITH_CACHED_TOKEN, | 21 REQUEST_AUTHORIZED_WITH_CACHED_TOKEN, |
| 21 REQUEST_AUTHORIZED_WITH_FRESH_TOKEN, | 22 REQUEST_AUTHORIZED_WITH_FRESH_TOKEN, |
| 22 }; | 23 }; |
| 23 | 24 |
| 24 class AuthenticatingURLLoaderImpl : public AuthenticatingURLLoader, | 25 class AuthenticatingURLLoaderImpl : public AuthenticatingURLLoader, |
| 25 public ErrorHandler { | 26 public ErrorHandler { |
| 26 public: | 27 public: |
| 27 AuthenticatingURLLoaderImpl( | 28 AuthenticatingURLLoaderImpl( |
| 28 InterfaceRequest<AuthenticatingURLLoader> request, | 29 InterfaceRequest<AuthenticatingURLLoader> request, |
| 29 authentication::AuthenticationService* authentication_service, | 30 authentication::AuthenticationService* authentication_service, |
| 30 NetworkService* network_service, | 31 NetworkService* network_service, |
| 32 std::map<GURL, std::string>* cached_tokens, | |
| 31 const Callback<void(AuthenticatingURLLoaderImpl*)>& | 33 const Callback<void(AuthenticatingURLLoaderImpl*)>& |
| 32 connection_error_callback); | 34 connection_error_callback); |
| 33 ~AuthenticatingURLLoaderImpl() override; | 35 ~AuthenticatingURLLoaderImpl() override; |
| 34 | 36 |
| 35 void SetAuthenticationService( | 37 void SetAuthenticationService( |
| 36 authentication::AuthenticationService* authentication_service); | 38 authentication::AuthenticationService* authentication_service); |
| 37 | 39 |
| 38 private: | 40 private: |
| 39 // AuthenticatingURLLoader methods: | 41 // AuthenticatingURLLoader methods: |
| 40 void Start(URLRequestPtr request, | 42 void Start(URLRequestPtr request, |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 51 | 53 |
| 52 void OnOAuth2TokenReceived(String token, String error); | 54 void OnOAuth2TokenReceived(String token, String error); |
| 53 | 55 |
| 54 Binding<AuthenticatingURLLoader> binding_; | 56 Binding<AuthenticatingURLLoader> binding_; |
| 55 authentication::AuthenticationService* authentication_service_; | 57 authentication::AuthenticationService* authentication_service_; |
| 56 NetworkService* network_service_; | 58 NetworkService* network_service_; |
| 57 Callback<void(AuthenticatingURLLoaderImpl*)> connection_error_callback_; | 59 Callback<void(AuthenticatingURLLoaderImpl*)> connection_error_callback_; |
| 58 URLLoaderPtr url_loader_; | 60 URLLoaderPtr url_loader_; |
| 59 URLResponsePtr pending_response_; | 61 URLResponsePtr pending_response_; |
| 60 RequestAuthorizationState request_authorization_state_; | 62 RequestAuthorizationState request_authorization_state_; |
| 61 String url_; | 63 GURL url_; |
| 62 bool auto_follow_redirects_; | 64 bool auto_follow_redirects_; |
| 63 bool bypass_cache_; | 65 bool bypass_cache_; |
| 64 Array<String> headers_; | 66 Array<String> headers_; |
| 65 String username_; | 67 String username_; |
| 66 String token_; | 68 String token_; |
| 67 Callback<void(URLResponsePtr)> pending_start_callback_; | 69 Callback<void(URLResponsePtr)> pending_start_callback_; |
| 70 std::map<GURL, std::string>* cached_tokens_; | |
| 68 }; | 71 }; |
| 69 | 72 |
| 70 } // namespace mojo | 73 } // namespace mojo |
| 71 | 74 |
| 72 #endif // SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_ | 75 #endif // SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_ |
| OLD | NEW |