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