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 CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ 6 #define CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ 7 8 #include "base/macros.h" 9 #include "base/memory/ref_counted.h" 10 #include "content/common/content_export.h" 11 #include "third_party/WebKit/public/platform/WebURLLoader.h" 12 13 class GURL; 14 15 namespace content { 16 17 class ResourceDispatcher; 18 struct ResourceResponseInfo; 19 20 class CONTENT_EXPORT WebURLLoaderImpl NON_EXPORTED_BASE(blink::WebURLLoader)21 : public NON_EXPORTED_BASE(blink::WebURLLoader) { 22 public: 23 explicit WebURLLoaderImpl(ResourceDispatcher* resource_dispatcher); 24 virtual ~WebURLLoaderImpl(); 25 26 static blink::WebURLError CreateError(const blink::WebURL& unreachable_url, 27 bool stale_copy_in_cache, 28 int reason); 29 static void PopulateURLResponse( 30 const GURL& url, 31 const ResourceResponseInfo& info, 32 blink::WebURLResponse* response); 33 34 // WebURLLoader methods: 35 virtual void loadSynchronously( 36 const blink::WebURLRequest& request, 37 blink::WebURLResponse& response, 38 blink::WebURLError& error, 39 blink::WebData& data) OVERRIDE; 40 virtual void loadAsynchronously( 41 const blink::WebURLRequest& request, 42 blink::WebURLLoaderClient* client) OVERRIDE; 43 virtual void cancel() OVERRIDE; 44 virtual void setDefersLoading(bool value) OVERRIDE; 45 virtual void didChangePriority(blink::WebURLRequest::Priority new_priority, 46 int intra_priority_value) OVERRIDE; 47 virtual bool attachThreadedDataReceiver( 48 blink::WebThreadedDataReceiver* threaded_data_receiver) OVERRIDE; 49 50 private: 51 class Context; 52 scoped_refptr<Context> context_; 53 54 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderImpl); 55 }; 56 57 } // namespace content 58 59 #endif // CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ 60