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

Side by Side Diff: services/authenticating_url_loader/authenticating_url_loader_impl.h

Issue 1155283003: Change AuthenticatingURLLoader to be a URLLoaderInterceptor (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Address review Created 5 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_
6 #define SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_
7
8 #include "mojo/public/cpp/bindings/binding.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"
11 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
12 #include "services/authenticating_url_loader/authenticating_url_loader_factory_i mpl.h"
13 #include "url/gurl.h"
14
15 namespace mojo {
16
17 class NetworkService;
18
19 enum RequestAuthorizationState {
20 REQUEST_INITIAL,
21 REQUEST_USED_CURRENT_AUTH_SERVICE_TOKEN,
22 REQUEST_USED_FRESH_AUTH_SERVICE_TOKEN,
23 };
24
25 class AuthenticatingURLLoaderImpl : public AuthenticatingURLLoader,
26 public ErrorHandler {
27 public:
28 AuthenticatingURLLoaderImpl(InterfaceRequest<AuthenticatingURLLoader> request,
29 AuthenticatingURLLoaderFactoryImpl* factory);
30 ~AuthenticatingURLLoaderImpl() override;
31
32 private:
33 // AuthenticatingURLLoader methods:
34 void Start(URLRequestPtr request,
35 const Callback<void(URLResponsePtr)>& callback) override;
36 void FollowRedirect(const Callback<void(URLResponsePtr)>& callback) override;
37
38 // ErrorHandler methods:
39 void OnConnectionError() override;
40
41 void StartNetworkRequest(URLRequestPtr request);
42
43 void OnLoadComplete(URLResponsePtr response);
44
45 void FollowRedirectInternal();
46
47 void OnOAuth2TokenReceived(std::string token);
48
49 Binding<AuthenticatingURLLoader> binding_;
50 AuthenticatingURLLoaderFactoryImpl* factory_;
51 URLLoaderPtr url_loader_;
52 URLResponsePtr pending_response_;
53 RequestAuthorizationState request_authorization_state_;
54 GURL url_;
55 bool auto_follow_redirects_;
56 bool bypass_cache_;
57 Array<HttpHeaderPtr> headers_;
58 Callback<void(URLResponsePtr)> pending_request_callback_;
59 };
60
61 } // namespace mojo
62
63 #endif // SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698