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 SKY_VIEWER_PLATFORM_WEBURLLOADER_IMPL_H_ | 5 #ifndef SKY_VIEWER_PLATFORM_WEBURLLOADER_IMPL_H_ |
6 #define SKY_VIEWER_PLATFORM_WEBURLLOADER_IMPL_H_ | 6 #define SKY_VIEWER_PLATFORM_WEBURLLOADER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "mojo/common/handle_watcher.h" | 9 #include "mojo/common/handle_watcher.h" |
10 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 10 #include "mojo/services/authenticating_url_loader/public/interfaces/authenticati
ng_url_loader.mojom.h" |
11 #include "sky/engine/public/platform/WebURLLoader.h" | 11 #include "sky/engine/public/platform/WebURLLoader.h" |
12 #include "sky/engine/public/platform/WebURLRequest.h" | 12 #include "sky/engine/public/platform/WebURLRequest.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
| 15 class AuthenticatingURLLoaderFactory; |
15 class NetworkService; | 16 class NetworkService; |
16 } | 17 } |
17 | 18 |
18 namespace sky { | 19 namespace sky { |
19 | 20 |
20 class WebURLLoaderImpl : public blink::WebURLLoader { | 21 class WebURLLoaderImpl : public blink::WebURLLoader { |
21 public: | 22 public: |
22 explicit WebURLLoaderImpl(mojo::NetworkService* network_service); | 23 explicit WebURLLoaderImpl( |
| 24 mojo::NetworkService* network_service, |
| 25 mojo::AuthenticatingURLLoaderFactory* authenticating_url_loader_factory); |
23 | 26 |
24 private: | 27 private: |
25 virtual ~WebURLLoaderImpl(); | 28 virtual ~WebURLLoaderImpl(); |
26 | 29 |
27 // blink::WebURLLoader methods: | 30 // blink::WebURLLoader methods: |
28 virtual void loadAsynchronously( | 31 virtual void loadAsynchronously( |
29 const blink::WebURLRequest&, blink::WebURLLoaderClient* client) override; | 32 const blink::WebURLRequest&, blink::WebURLLoaderClient* client) override; |
30 virtual void cancel() override; | 33 virtual void cancel() override; |
31 | 34 |
32 void OnReceivedResponse(mojo::URLResponsePtr response); | 35 void OnReceivedResponse(mojo::URLResponsePtr response); |
33 void OnReceivedError(mojo::URLResponsePtr response); | 36 void OnReceivedError(mojo::URLResponsePtr response); |
34 void OnReceivedRedirect(mojo::URLResponsePtr response); | 37 void OnReceivedRedirect(mojo::URLResponsePtr response); |
35 void ReadMore(); | 38 void ReadMore(); |
36 void WaitToReadMore(); | 39 void WaitToReadMore(); |
37 void OnResponseBodyStreamReady(MojoResult result); | 40 void OnResponseBodyStreamReady(MojoResult result); |
38 | 41 |
39 blink::WebURLLoaderClient* client_; | 42 blink::WebURLLoaderClient* client_; |
40 GURL url_; | 43 GURL url_; |
41 mojo::URLLoaderPtr url_loader_; | 44 mojo::AuthenticatingURLLoaderPtr url_loader_; |
42 mojo::ScopedDataPipeConsumerHandle response_body_stream_; | 45 mojo::ScopedDataPipeConsumerHandle response_body_stream_; |
43 mojo::common::HandleWatcher handle_watcher_; | 46 mojo::common::HandleWatcher handle_watcher_; |
44 | 47 |
45 base::WeakPtrFactory<WebURLLoaderImpl> weak_factory_; | 48 base::WeakPtrFactory<WebURLLoaderImpl> weak_factory_; |
46 | 49 |
47 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderImpl); | 50 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderImpl); |
48 }; | 51 }; |
49 | 52 |
50 } // namespace sky | 53 } // namespace sky |
51 | 54 |
52 #endif // SKY_VIEWER_PLATFORM_WEBURLLOADER_IMPL_H_ | 55 #endif // SKY_VIEWER_PLATFORM_WEBURLLOADER_IMPL_H_ |
OLD | NEW |